DISABLE ENABLE and DROP TRIGGERS

DISABLE ENABLE and DROP TRIGGERS – Learn how to disable and enable trigger on a table with examples. Also Learn how to remove a triggers from database using DROP Triggers.

Disable a Trigger

If we don’t want to fire a trigger on a table then we want to disable that trigger.

Syntax

ALTER TRIGGER trigger_name DISABLE;

Example

ALTER TRIGGER DISP_NEW_EMP_DATA DISABLE;

This example uses the ALTER TRIGGER statement to disable the trigger called DISP_NEW_EMP_DATA .

Disable all Triggers

If we don’t want to fire all triggers that created on a table, then we want to disable all the triggers.

Here the syntax to disable all the triggers on a table at once

Syntax

ALTER TABLE table_name DISABLE ALL TRIGGERS;

Example

ALTER TABLE EMP1 DISABLE ALL TRIGGERS;

This example uses the ALTER TRIGGER statement to disable all triggers on the table called EMP

Enable a Trigger

If you find the trigger on a table is disabled and now you want to enable the trigger,Then we can do with the alter statement.

Syntax

ALTER TRIGGER trigger_name ENABLE;

Example

ALTER TRIGGER DISP_NEW_EMP_DATA ENABLE;

This example uses the ALTER TRIGGER statement to enable the trigger called DISP_NEW_EMP_DATA.

Enable all Triggers

If you find that all the triggers on a table is disabled , if you want to enable all the triggers on a table then we can do all with alter statement.

Here is the syntax to enable all the triggers on a table.

Syntax

ALTER TABLE table_name ENABLE ALL TRIGGERS;

Example

ALTER TABLE EMP ENABLE ALL TRIGGERS;

This example uses the ALTER TABLE statement to enable all triggers on the table called EMP .

DROP TRIGGER

If you want to remove a trigger on a table from a database, then we can drop the triggers with DROP statement.

Syntax

DROP TRIGGER trigger_name;

Example

DROP TRIGGER DISP_NEW_EMP_DATA;

Related Posts