Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle/SQL: Check If Trigger Enabled/Disabled

How do you check if a specific trigger is enabled or disabled in Oracle/SQL?

The following specifies if my trigger is valid or not -- but not enabled or disabled

SELECT *
FROM   ALL_OBJECTS
WHERE  OBJECT_TYPE = 'TRIGGER' AND OBJECT_NAME = 'the_trigger_name';

My Oracle Database version: 12c - Enterprise Edition v12.1.0.2.0 - 64bit


I have checked StackOverflow and came across the following posts, but didn't find an answer specific to Oracle/SQL:

  • SQL Server: check whether a Trigger is Enabled or Disabled?
  • ORACLE SQL Status check trigger
  • How to check if a trigger is invalid?
like image 653
Rushikumar Avatar asked Mar 29 '18 13:03

Rushikumar


2 Answers

This query also worked for me:

SELECT trigger_name,status
FROM dba_triggers
WHERE trigger_name = upper ('TRIGGERNAME');
like image 186
mggSoft Avatar answered Oct 19 '22 01:10

mggSoft


user_triggers is the table where all triggers created, specific to the schema, are located.

So,

SELECT STATUS FROM USER_TRIGGERS WHERE TRIGGER_NAME = 'the_trigger_name';

will fetch the status of either ENABLED or DISABLED.

Also, to fetch ALL triggers and their statuses--

SELECT TRIGGER_NAME, STATUS FROM USER_TRIGGERS;
like image 35
Rushikumar Avatar answered Oct 19 '22 01:10

Rushikumar