Disable Trigger

This Article will help you to understand “Disable Trigger” with examples and it’s detailed description.

By Default, trigger status is ENABLED.

Sometimes we will need to DISABLE trigger in some conditions like below.

  1. An object that the trigger references is not available.
  2. You must perform a large data load and want it to proceed quickly without firing triggers.
  3. You are loading data into the table to which the trigger applies.

ALTER TRIGGER statement used to disable trigger.

Disable Trigger Example

For better understanding we will create table “sample_data”.

Then create trigger “trg_test_disable” on sample_data table.

We will check the trigger status from “USER_TRIGGERS” table. This table contains all details about triggers.

Then we will DISABLE trigger by ALTER TRIGGER statement and then check again the USER_TRIGGERS table and check the status of this trigger.

Code
Output
table SAMPLE_DATA created.
Output
TRIGGER TRG_TEST_DISABLE compiled

To learn ENABLE trigger, Please refer ENABLE TRIGGER

TRIGGER_NAME STATUS
TRG_TEST_DISABLE ENABLED
Output
trigger TRG_TEST_DISABLE altered.

Now again check the status of trigger.

TRIGGER_NAME STATUS
TRG_TEST_ENABLE DISABLED
References
  1. Syntax :- Oracle official docs
  2. Disabling triggers :- Oracle official docs
  3. PL/SQL Triggers :- Oracle official docs
It's good to share...Share on FacebookTweet about this on TwitterShare on LinkedInPin on PinterestShare on Google+Email this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *