Restore trigger create statement from user_trigger table : user_triggers « System Tables Views « Oracle PL / SQL






Restore trigger create statement from user_trigger table

   
SQL>
SQL>
SQL>
SQL>
SQL> select
  2  'create or replace trigger "' || trigger_name || '"' || chr(10)||
  3   decode( substr( trigger_type, 1, 1 ),'A', 'AFTER', 'B', 'BEFORE', 'I', 'INSTEAD OF' ) ||chr(10) ||triggering_event || chr(10) ||
  4   'ON "' || table_owner || '"."' || table_name || '"' || chr(10) ||
  5   decode( instr( trigger_type, 'EACH ROW' ), 0, null,'FOR EACH ROW' ) || chr(10) ,
  6   trigger_body
  7  from user_triggers
  8  where trigger_name = upper('YourTriggerName')
  9        and rownum < 50
 10  /

no rows selected

SQL>
SQL> --

   
    
  








Related examples in the same category

1.Query user_triggers
2.Query user_triggers with trigger name
3.If trigger exists, drop trigger
4.Check the status of the trigger