Trigger Drop by Oracle Procedure
Trigger Drop by Oracle Procedure
Topic Introduction: "Trigger Drop by Oracle Procedure", By the drop command, we can delete any trigger from our database. In this post, we will show how to delete or drop a trigger by PL/SQL Procedure.
1. Procedure Creation for Trigger Drop
CREATE OR REPLACE PROCEDURE drop_trigger_if_exists(p_trigger_name VARCHAR2)ASl_exist PLS_INTEGER;BEGIN-- get the trigger countSELECT COUNT(*) INTO l_existFROM user_triggersWHERE trigger_name = UPPER(p_trigger_name);-- if the trigger exist, drop itIF l_exist > 0 THENEXECUTE IMMEDIATE 'DROP TRIGGER ' || p_trigger_name;END IF;END;
2. Procedure Execution for Trigger Drop
EXEC drop_trigger_if_exists('customers_credit_trg');
No comments