oracle - Execution of Multiple procedures one after another is not working -
i trying execute procedure in turn should execute 4 other procedures 1 after other. how acheive this?
create or replace procedure mainproc begin tack(400); phno_insert; address_insert; academics_insert; commit; end;
error report:
pls-00905: object phno_insert invalid. pl/sql: statement ignored. pls-00905: object address_insert invalid. pl/sql: statement ignored. pls-00905: object academics_insert invalid. pl/sql: statement ignored.
the problem seems in fact have procedure doing ddl on object statically referenced in procedure; example, if define:
create table runtimetable select 1 one dual; create or replace procedure createtable begin execute immediate 'drop table runtimetable'; execute immediate 'create table runtimetable select 1 one dual'; end; create or replace procedure usetable vvar number; begin select 1 vvar runtimetable; -- dbms_output.put_line(vvar); end; create or replace procedure createandusetable begin createtable; usetable; end; /
when try execute createandusetable
get:
ora-04068: existing state of packages has been discarded ora-04065: not executed, altered or dropped stored procedure "alek.usetable" ora-06508: pl/sql: not find program unit being called: "alek.usetable" ora-06512: @ "alek.createandusetable", line 4 ora-06512: @ line 1
if strictly need ddl runtime, need use dynamic sql reference modified object; example if define procedure usetable
way
create or replace procedure usetable vvar number; begin execute immediate 'select 1 runtimetable' vvar; -- dbms_output.put_line(vvar); end;
the call createandusetable
work:
sql> exec createandusetable 1
Comments
Post a Comment