Discussions
Categories
- 196.8K All Categories
- 2.2K Data
- 238 Big Data Appliance
- 1.9K Data Science
- 450.2K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 544 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.8K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.5K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 154 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 437 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
Oracle Apex - Create Procedure to Insert Records from Another Table

Dear Friends
We want to insert data from A table to B table. How it will be written in Oracle Apex Forms.
In the form 12c i was writing the code in the following way, now in apex how to write.
Create Procedure Test1 as
Declare
Cursor a1 is select empno,name from employee;
begin
delete from test1;
commit;
for i in a1
loop
insert into test1(empno,name)
values (i.empno,i.name);
end loop;
COMMIT_FORM;
end;
sanjay
Best Answer
-
APEX is stateless. It automatically calls
COMMIT
as needed (orROLLBACK
).I'd keep it simple, Sanjay (K.I.S.S.)
BEGIN DELETE FROM TEST1; INSERT INTO TEST1 (empno,name) SELECT empno, name FROM EMPLOYEE; END;
Answers
-
It looks like table TEST1 is being used as a temp table.
In Forms, this should probably have been a GTT.
GTTs don't work in APEX dye to Connection Pooling. You'd use a Collection instead.
But, I'm just guessing about the purpose of TEST1.
(PS - you should probably have just done an INSERT... SELECT instead of parsing a cursor in a loop)
-
Dear Mike Kutz
I want to delete all the old records from test1. then i want to update the table with the latest Query data from test table. can you suggest how to insert the records using the procedure in Oracle Apex .
- Delete all Data from A Table
- Query on Table B and get the data
- Insert the Query data into A Table.
Sanjay
-
APEX is stateless. It automatically calls
COMMIT
as needed (orROLLBACK
).I'd keep it simple, Sanjay (K.I.S.S.)
BEGIN DELETE FROM TEST1; INSERT INTO TEST1 (empno,name) SELECT empno, name FROM EMPLOYEE; END;
-
Dear Mike Kutz
Thanks , your given Query is perfectly runing on Sql Command, but the same Query when i update in the Form at server side condition , it's not working . it truncate the data but not updating with fresh data from the called table.
Kindly sugget .
Sanjay
-
As you are running this from a Dynamic Action it will be running in a different database session to that of your page. If your page hasn't committed it's data, the session in your DA will not see that data.
Is there a particular reason you are doing this work through a DA and not through a process?
-
Dear AndyH
I am new to Oracle Apex and Learning , Can you please give me some tips , how to take such query from Process.
Its getting executed properly , but i don't know how to display the message once the Procedure Query will update the table . Can you please suggest.
Sanjay