I have a text area field in my page and a submit button which should insert the values inside a table with a process after submit (processing->After submit->Process):
INSERT INTO my_table (name)
(SELECT RTRIM(COLUMN_VALUE, CHR(13))
FROM TABLE(apex_string.split(:my_text_area, CHR(10))));
This works very well but not for > 2000 rows. Is there a limitation for submitting more then X character? The large data is correctly inserted into the text area field, I checked.
Is there any alternative way to paste data into a region and insert it into an existing table (without file upload)?
There is a character limit on the text area. You'll have to google what it is (either 4k or 32k not sure). In the upcoming version 22.2 there will be CLOB support for page items so then this should be possible.
In the versions below 22.2 you can use a plugin (for example this one: https://github.com/OraOpenSource/apex-plugin-clob-load). But then you cannot use a page process to loop through the strings since the plugin will save the value in a table. You'll probably have to implement the logic you have in the question in a trigger or a procedure on the table where the clob is saved to.
Related
I am using Apex 18.2. I created an interactive report which has 10 records. I try to add a logic that user can only be able to edit those records which recently created. User cannot do an edit to an old records. Means when user try to edit old records, it show as 'Display only' or not editable. Is there any way I can do that? Your help is really appreciated. Thanks
One option is to create your own link (icon, if you wish), just like another column in report's query.
As you're in SQL now, use any condition you want. Obviously, you have to be able to distinguish "old" from "new" rows. If we suppose that it is some DATE datatype column, so whatever is "yesterday" or older is considered to be "old", you'd
select case when datum < trunc(sysdate) then null
else 'Click here'
end as link,
empno,
ename
from emp
LINK column's type would be "link" (of course) and you'd make it navigate to another page in this application, pass values from here to there, etc.
I was wondering how does ORACLE APEX identify if a certain page item value should go as number or varchar2 when used in stored procedure call.
my_pkg.proc1(P1 =>:P2_ITEM1);
Here, how does APEX engine identify if the parameter P1 for proc1 is expecting a number or varchar2 or date.
To extend:
I have a grid. With query as below
Select * from table(my_pkg.pipe_func(:P2_PARAM1,:P2_PARAM2));
When user clicks a button I need to get the current session state value of these bind substitutions and I want to store above select query in a table as
Select * from table(my_pkg.pipe_func('ParamVal',256));
How can this be achieved?
It's the Oracle database that does this grunt work, in the same way it's done it for years. You can see this in the v$sqlarea.
And you should explicity convert these bind variables, as they will be inheretly treated as a varchar - same as they're stored.
where id = to_number(:p1_id)
And from an APEX perspective, if the user changes a value on screen, and you invoke a dynamic action to refresh a region using those items - you should list them in the 'Page items to submit' attribute, just under the region SQL. This will ensure the database session state is updated with what's in the browser, before conducting the refresh.
I'm very much new to oracle apex and have been constantly failing on creating tabular form for inserting data into my table. My scenario is as follows.
i have two tables
1. tasks(task_id, task_Name)
2. Efforts (Eff_id,Task_id,Hours_spent,NOtes).
I want to create a tabular form to insert data into Efforts table with the tasks that I've in Tasks table. I created the tabular form with the query below.
SELECT APEX_ITEM.CHECKBOX(1,TASK_ID) "TASK_ID",
TASK_NAME,
APEX_ITEM.TEXT(2,'')"HOURS_SPENT",
APEX_ITEM.TEXT(3,'')"NOTES"
FROM TASKS;
but when I create the "after Submit" process to read the values of this report and tried to insert into my table effortS with the following code, something strange is happening. When i select the checkbox of row-1,2 and 3 then only row 1 is getting inserted into my efforts table but for the rest, only task id values are getting inserted not the whole row. I was missing "hours_spent and NOtes". in my efforts table for rows-2 and 3..here is my plsql block
BEGIN
FOR i in APEX_APPLICATION.G_F01.COUNT LOOP
INSERT INTO EFFORTS(EFF_ID,TASK_ID,HOURS_SPENT,NOTES)
VALUES (SEQ_EFFORTS.NEXTVAL,APEX_APPLICATION.G_F01(i),APEX_APPLICATION.G_F02(i),APEX_APPLICATION.G_F03(i))
END LOOP;
commit;
END;
Can Someone help me! if there's another way of doing my requirement, then I'm more than happy to do it..
Welcome to the APEX community.
This is a classic problem, due to the nature of HTML
Get the values of the selected rows with checked checkbox
Note, the usage of tabular forms is also waning in favour of Interactive Grids.
I want to display single record one by one when button press in tabular form
how to do this in oracle forms?
I'd suggest you to use Forms built-in capabilities and spend time and energy on something else.
i want to display single record when press button single forward and all records when press button double forward
I presume that those buttons ("single" and "double forward") are custom-made buttons (i.e. you created them).
If so, "Double forward" is simple - put EXECUTE_QUERY into its WHEN-BUTTON-PRESSED trigger (assuming that this is a data block, based on a table).
"Single forward" isn't that simple as you can't execute query, so you have to write some code. For example, you could "prepare" result data set into another table, specifying the row number so that you could later use it:
insert into temp_table (rn, deptno, dname, loc)
select rownum, deptno, dname, loc
from dept
where ...
WHERE clause is kind of tricky because user can enter search criteria. How to know it? Use GET_BLOCK_PROPERTY. As it brings scent of dynamic SQL, you'd have to compose the INSERT statement - consider creating a stored procedure which utilizes EXECUTE IMMEDIATE (or, alternatively, see if FORMS_DDL can be used).
As many users can use the same form simultaneously, that "temp table" should be a global temporary table or - if not - you'd have to save user information as well; otherwise, you'll create a chaos.
Suppose data is now prepared. In a form, you'd have to create a parameter (or a global variable) which holds current "row number" (rn) value. "Single forward" button's trigger would then
last_record;
create_record;
select deptno, dname, loc
into :blk.deptno, :blk.dname, :blk.loc
from temp_table where rn = :parameter.rn;
-- prepare the next row
:parameter.rn := :parameter.rn + 1;
OK, now you have your data, and new problems arrive. As it is a data block, inserting values into it in that manner presumes that you inserted brand new set of information, and Forms will treat it like that. So, if you try to save it, you'll get a unique key violation (which is OK) or duplicate data (which is bad).
It means that "data block" should, actually, be a "control block", which isn't related to a table. Furthermore, it means that "Double forward" can't work the way I described, but by modifying "Single forward" button's code (don't fetch row-by-row, but all of them at once).
If it is a control block, now you have to find a way to store modified values as well as newly added records, so you'd have to create your own ON-INSERT, ON-UPDATE, etc. triggers.
Shortly, I don't think that what you want is a simple task. Did I already say that you shouldn't do it in the first place? Well, I still think so.
Hopefully, someone else will have a better, simpler suggestion.
Currently had a request to automatically add data in a form window into two tables at once. I was able to accomplish this with simple insert functions as processes, but for the life of me I can not figure out how to get the attached file in the file browse to attach to the other table using am insert function. The blob column always shows up as [unsupported datatype].
Here's my current insert code, let me know I'm being an idiot and missing something simple.
insert into ATTACHMENTS_AVAIL ("ADDED_FILE", "MIMETYPE", "FILENAME", "CONTRACTOR_ID", "DATE_ADDED", "TYPE")
values
(:P159_RESUME,
:P159_MIMETYPE,
:P159_FILENAME,
:P159_CONTRACTOR_ID,
sysdate,
'Resume');
ADDED_FILE is the blob column and :P159_RESUME is the file browse form.
Thanks again!
Inserting the BLOB
Your insert statement isn't getting the BLOB data, just the APEX file ID. You need to do something more like this:
insert into ATTACHMENTS_AVAIL ("ADDED_FILE", "MIMETYPE", "FILENAME", "CONTRACTOR_ID", "DATE_ADDED", "TYPE")
select blob_content,
:P159_MIMETYPE,
:P159_FILENAME,
:P159_CONTRACTOR_ID,
sysdate,
'Resume'
from apex_application_files where name = :P159_RESUME;
In fact, apex_application_files has other columns to tell you the mime type etc.
Viewing the BLOB
You are trying to view the BLOB data in APEX's SQL Workshop. That can't display BLOBs (it just shows "[unsupported datatype]" as you found), but that doesn't mean the BLOB data is invalid. A BLOB can contain anything - music in MP3 format, picture in JPEG, video in MP4, Microsoft Word document, etc. etc. No tool can "display" all of these.
If you create a new page with a report on it to show the data, you can set the BLOB column's Type to Display Image if the BLOB always contains an image, or to Download BLOB if it may contain non-image data.