Monday, July 20, 2020

Disable trigger based on some condition



/* following command will disable the RK Trigger at NON RK Client only */


declare lchost varchar2(100); 
begin
select host into lchost from dba_db_links where db_link='LNK_RAKSHAK'; 
if ( trim(upper(lchost)) like '%RAKSHAK%' ) 
THEN 
  BEGIN
  FOR cur_rec IN (SELECT trigger_name 
                  FROM   dba_triggers WHERE trigger_name like 'TG_RK%') LOOP
    BEGIN
      EXECUTE IMMEDIATE 'alter trigger ldbo.' || cur_rec.trigger_name || ' DISABLE' ;
    END;
  END LOOP;
END;
END IF ;
END;
/



No comments:

Post a Comment

Followers