Disable and enable a trigger : Disable Trigger « Trigger « Oracle PL / SQL






Disable and enable a trigger

   
SQL>
SQL> Disable and enable a trigger
SQL>
SQL>
SQL> create table all_upper_data(
  2    data varchar2(255) );

Table created.

SQL>
SQL> create or replace trigger bifer_all_upper_data
  2    before insert
  3      on all_upper_data
  4    for each row
  5  begin
  6    :new.data := upper( :new.data );
  7  end;
  8  /

Trigger created.

SQL>
SQL> insert into all_upper_data( data ) values ( 'chris' );

1 row created.

SQL>
SQL> select * from all_upper_data;

DATA
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------
CHRIS

SQL>
SQL> alter trigger bifer_all_upper_data disable;

Trigger altered.

SQL>
SQL> insert into all_upper_data( data ) values ( 'sean' );

1 row created.

SQL>
SQL> select * from all_upper_data;

DATA
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------
CHRIS
sean

SQL>
SQL> alter trigger bifer_all_upper_data enable;

Trigger altered.

SQL>
SQL> insert into all_upper_data( data ) values ( 'mark' );

1 row created.

SQL>
SQL> select * from all_upper_data;

DATA
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------
CHRIS
sean
MARK

SQL>
SQL>
SQL> drop table all_upper_data;

Table dropped.

SQL> 

   
    
  








Related examples in the same category

1.Disable a Trigger
2.Disable all triggers
3.Alter trigger to disable it
4.Use NDS to disable the trigger