-
StackOverflow 文件
-
db2 教程
-
DB2 約束資訊
-
根據約束名稱獲取約束資訊
select cst.constraint_schema, cst.constraint_name,
fk.table_name, fk.ordinal_position, fk.column_name,
pk.table_name, pk.column_name
from qsys2.syscst cst join qsys2.syskeycst fk
on fk.constraint_schema = cst.constraint_schema
and fk.constraint_name = cst.constraint_name
join qsys2.sysrefcst ref
on ref.constraint_schema = cst.constraint_schema
and ref.constraint_name = cst.constraint_name
join qsys2.syskeycst pk
on pk.constraint_schema = ref.unique_constraint_schema
and pk.constraint_name = ref.unique_constraint_name
where fk.ordinal_position = pk.ordinal_position
and cst.constraint_name = 'CST NAME'
order by cst.constraint_schema, cst.constraint_name