您的位置:首页 > 数据库 > Oracle

ORACLE 判断触发器是否存在,如果存在就删除

2012-06-06 12:35 288 查看
declare   

 V_NUM number;   
BEGIN 

   ----多次删除时,每次都将v_num设置成为0

    V_NUM := 0;  

    ----判断触发器  TABLE_NAME 是否存在(区分大小写)

    select count(0) into V_NUM from user_triggers where trigger_name = 'tib_bpd_business_process_link';

    ----如果存在立即删除  

    if V_NUM > 0 then   

    execute immediate 'DROP TRIGGER  tib_bpd_business_process_link';   

    end if;

    

        ----多次删除时,每次都将v_num设置成为0

    V_NUM := 0;  

    ----判断触发器  TABLE_NAME 是否存在(区分大小写)

    select count(0) into V_NUM from user_triggers where trigger_name = 'tib_bpd_interface_service';

    ----如果存在立即删除  

    if V_NUM > 0 then   

    execute immediate 'DROP TRIGGER  tib_bpd_interface_service';   
    end if;

END;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息