Perform execute immediate within a trigger
Posted on 2008-10-17
Can I do excute an sql dynamically within a trigger. I have an execute immediate statement as given below:
CREATE OR REPLACE TRIGGER MYTRIGGER
AFTER DELETE OR INSERT OR UPDATE
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
v_SQL := myPkg.getViewSQL;
EXECUTE IMMEDIATE v_SQL;
All I am doing is getting a sql (which is a create or replace view statement) and trying to execute it within the trigger.
I am getting an error
ORA-00936: missing expression
ORA-06512: at "MY_SCHEMA.MY_TRIGGER", line 5
ORA-04088: error during execution of trigger "MY_SCHEMA.MY_TRIGGER"
Any help is appreciated