Oracle/SQL:检查触发器是否启用/禁用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49557423/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:30:41  来源:igfitidea点击:

Oracle/SQL: Check If Trigger Enabled/Disabled

oracleoracle12c

提问by Rushikumar

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

您如何检查在 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

我的 Oracle 数据库版本:12c - 企业版 v12.1.0.2.0 - 64 位



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

我检查了 StackOverflow 并遇到以下帖子,但没有找到特定于 Oracle/SQL 的答案:

回答by Rushikumar

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

user_triggers是所创建的所有触发器(特定于架构)所在的表。

So,

所以,

SELECT STATUS FROM USER_TRIGGERS WHERE TRIGGER_NAME = 'the_trigger_name';

will fetch the status of either ENABLEDor DISABLED.

将获取ENABLED或的状态DISABLED

Also, to fetch ALL triggers and their statuses--

此外,要获取所有触发器及其状态--

SELECT TRIGGER_NAME, STATUS FROM USER_TRIGGERS;