如何同时列出2个表的所有CONSTRAINTS?

时间:2013-01-12 15:44:03

标签: sql oracle oracle-apex

我需要一些帮助。我知道您可以使用Oracle Apex Application Express 4.0.2.00.07中的SQL Command函数一次查看1个表的约束。我想知道如何在同一命令中修改下面的命令以查看我的其他表的约束。这可能吗? (例如tblOrder, tblProduct

SELECT constraint_name, 
       constraint_type
  FROM USER_CONSTRAINTS
 WHERE table_name = 'tblCustomer';

如果你能提供帮助,我真的很感激。

2 个答案:

答案 0 :(得分:1)

SELECT constraint_name, constraint_type
FROM USER_CONSTRAINTS
WHERE table_name IN ('tblOrder', 'tblProduct','tblCustomer');

答案 1 :(得分:1)

您可以使用IN,列出表格;

SELECT table_name, constraint_name, constraint_type 
FROM USER_CONSTRAINTS 
WHERE table_name IN ('tblCustomer', 'tblOrder', 'tblProduct')

...或者因为USER_CONSTRAINTS只保存当前用户的表,只需通过完全删除WHERE来清单列出用户拥有的所有表的所有约束;

SELECT table_name, constraint_name, constraint_type 
FROM USER_CONSTRAINTS