Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multiple dynamic statements

user5166911Jan 7 2022

Hi everyone.
We would like to execute multiple sql and/or pl/sql statements within the same dynamic SQL block. What are we trying to do is something very similar to the Oracle Apex Supporting Objects Installation: practically we're saving scripts into a CLOB column in our dev environment, and next execute them against a test database.
This is an example:

begin
    execute immediate '
create trigger bi_magana_test
before insert on magana_test
for each row
begin
    select max(id, 0) + 1 into :new.id from magana_test;
end;
/
alter trigger bi_magana_test enable;';

end;

We are struggling on how to run multiple statements within the same EXECUTE IMMEDIATE or any other way that Oracle could provide.
Thanks for any help.

Comments
Post Details
Added on Jan 7 2022
9 comments
1,422 views