Enable and disable triggers : Disable Enable Trigger « Trigger « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> SET VERIFY OFF;
SQL> SET SERVEROUTPUT ON;
SQL>
SQL> DECLARE
  2     cur INTEGER;
  3     done EXCEPTION;
  4     cnt NUMBER := 0;
  5  BEGIN
  6     FOR user_trg IN (SELECT trigger_name FROM user_triggers)
  7     LOOP
  8        BEGIN
  9           cnt := cnt + 1;
 10           cur := DBMS_SQL.open_cursor;
 11
 12           DBMS_SQL.parse (cur,'ALTER TRIGGER  ' || user_trg.trigger_name || ' ENABLE',DBMS_SQL.native);
 13           DBMS_SQL.parse (cur,'ALTER TRIGGER ' || user_trg.trigger_name || ' DISABLE',DBMS_SQL.native);
 14        EXCEPTION
 15           WHEN OTHERS
 16           THEN
 17              DBMS_OUTPUT.put_line (SQLCODE || '-' || SQLERRM);
 18              DBMS_SQL.close_cursor (cur);
 19        END;
 20     END LOOP;
 21  END;
 22  /

PL/SQL procedure successfully completed.








28.8.Disable Enable Trigger
28.8.1.Disable a trigger
28.8.2.Enable a trigger
28.8.3.Enable and disable triggers
28.8.4.Alter trigger to disable it or enable it