[英]How to search for triggers in a schema in DB2 9.7?
I have a list of tables in a schema in IBM DB2 9.7. 我在IBM DB2 9.7中的模式中有一个表列表。 Some of them have triggers and others do not.
其中一些有触发器而另一些则没有。 I am creating a stored procedure that goes through all tables in SYSCAT.TABLES, but how do I check with sql syntax if that table has a trigger with a specific name?
我正在创建一个遍历SYSCAT.TABLES中所有表的存储过程,但是如果该表具有特定名称的触发器,我如何检查sql语法? (or any trigger)
(或任何触发器)
You can use the SYSCAT.TRIGGERS
catalog view. 您可以使用
SYSCAT.TRIGGERS
目录视图。
SELECT *
FROM SYSCAT.TRIGGERS
WHERE TABNAME = @table_name
AND TABCREATOR = @table_schema
AND TRIGNAME = @trigger_name
AND TRIGSCHEMA = @trigger_schema
The predicates given are just examples of columns you might search by, you can obviously pick and choose based on your needs. 给出的谓词只是您可能搜索的列的示例,您显然可以根据您的需要进行选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.