Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DISABLE TRIGGERS 1

Status
Not open for further replies.

fmsousa

IS-IT--Management
Nov 24, 2000
28
PT
Hi,
I would like to know, if possible, how can i disable a trigger inside a stored procedure.

I know that the following instruction disable the trigger (but it won't work inside a strored procedure):

ALTER TRIGGER <name_trigger> DISABLE;

Thanks in advance.
Best regards,
Fernando Sousa
 

You have to use dynamic SQL or dbms_sql utility.

For example (Oracle 7):

--add in your declaration
V_CURSORID INTEGER;
V_NUMROWS INTEGER;
V_TRIGSTRING VARCHAR2(1999);


-- add inside the program part
V_CURSORID := DBMS_SQL.OPEN_CURSOR;
V_TRIGSTRING := 'ALTER TRIGGER mytrig DISABLE';
DBMS_SQL.PARSE(V_CURSORID, V_TRIGSTRING, DBMS_SQL.NATIVE);
DBMS_SQL.CLOSE_CURSOR(V_CURSORID);
COMMIT;

For Oracle 8, you can use EXECUTE IMMEDIATE.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top