简体   繁体   中英

DB2, Stored Procedures that are refering to a table name

在DB2中-执行任何SQL语句时,将返回引用表名的存储过程列表。

You can utilize the catalog view SYSCAT.ROUTINEDEP for that:

select specificname, routineschema from syscat.routinedep where btype='F' and bschema='yourschema' and bname='yourtable'

This will return all routines (incl. stored procedures) dependent on that referenced table identified by yourschema.yourtable

There is a catalog view SYSCAT.ROUTINEDEP :

SELECT R.ROUTINESCHEMA, R.ROUTINENAME 
FROM SYSCAT.ROUTINEDEP D, SYSCAT.ROUTINES R
WHERE D.ROUTINESCHEMA = R.ROUTINESCHEMA AND D.SPECIFICNAME = R.SPECIFICNAME 
AND D.BTYPE IN ('T','V','A') 
AND D.BSCHEMA = 'MYTABLESCHEMA' AND D.BNAME = 'MYTABLENAME'

Keep in mind that tables referenced by dynamic SQL will not appear in SYSCAT.ROUTINEDEP .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM