Professional Documents
Culture Documents
Summary: in this tutorial, you will learn how to use the Oracle DROP TRIGGER statement to remove
a trigger from the database.
In this syntax, you specify the name of the trigger that you want to remove after the DROP TRIGGER
keywords.
Optionally, you can specify the name of the schema to which the trigger belongs. If you skip the
schema_name , Oracle will assume that the trigger is in your own schema.
Note that the trigger that you remove must be in your own schema or you must have the
DROP ANY TRIGGER system privilege (https://www.oracletutorial.com/oracle-administration/oracle-grant/)
.
If you attempt to remove a trigger that does not exist, Oracle will issue the error ORA-04080 ,
indicating that the trigger does not exist.
https://www.oracletutorial.com/plsql-tutorial/oracle-drop-trigger/ 1/3
10/17/22, 4:33 PM Learn Oracle DROP TRIGGER By Practical Examples
in_trigger_name VARCHAR2
AS
l_exist PLS_INTEGER;
BEGIN
FROM user_triggers
END IF;
END;
In this procedure:
First, get the number of triggers that matches the input trigger from the user_triggers data
dictionary view using the COUNT() (https://www.oracletutorial.com/oracle-aggregate-functions/oracle-
count/) function.
Then, use the EXECUTE IMMEDIATE statement to execute a dynamic SQL statement which
removes the trigger.
https://www.oracletutorial.com/plsql-tutorial/oracle-drop-trigger/ 2/3
10/17/22, 4:33 PM Learn Oracle DROP TRIGGER By Practical Examples
EXEC drop_trigger_if_exists('customers_credit_trg');
And this example use the drop_trigger_if_exists procedure to remove a trigger that does not
exist:
EXEC drop_trigger_if_exists('customers_xyz_trg');
In this tutorial, you have learned how to use the Oracle DROP TRIGGER statement to remove a
trigger from the database.
https://www.oracletutorial.com/plsql-tutorial/oracle-drop-trigger/ 3/3