Oracle PL/SQL – Delete Trigger example

摘要: This article shows you how to use DROP TRIGGER to delete a trigger.

This article shows you how to use DROP TRIGGER to delete a trigger.

-- delete  a trigger
DROP TRIGGER trigger_name;
Note
In DROP TRIGGER statement, recommend to specify a schema name before trigger name. If you don’t specify a schema name, then database will assume that the trigger is in your own schema.

1. Table + Trigger

1.1 Create a table and a trigger on it.

demo_data
create table demo_data
id number(5) primary key,
project_name varchar2(10)
);
trg_drop_example
CREATE OR REPLACE TRIGGER trg_drop_example
BEFORE
     UPDATE OR DELETE OR INSERT
ON demo_data
  FOR EACH ROW 
BEGIN
  dbms_output.put_line('trg_drop_example Trigger called.');
END;

2. DROP TRIGGER example

2.1 Check the trigger status :

SELECT TRIGGER_NAME,STATUS FROM USER_TRIGGERS where upper(TRIGGER_NAME) = 'TRG_DROP_EXAMPLE';
TRIGGER_NAME

STATUS
TRG_DROP_EXAMPLE ENABLED

2.2 Delete the trigger.

DROP TRIGGER trg_drop_example;
-- output
-- Trigger trg_drop_example dropped.

2.3 Check the status again.

SELECT TRIGGER_NAME,STATUS FROM USER_TRIGGERS where upper(TRIGGER_NAME) = 'TRG_DROP_EXAMPLE';
-- output
-- no rows selected.

References

  1. Oracle – DROP TRIGGER
  2. Oracle – PL/SQL Triggers
  3. Check trigger status

上一篇: Oracle PL/SQL Before UPDATE Trigger example
下一篇: Oracle PL/SQL – Enable and Disable Triggers
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号