Suits999
Suits999

Reputation: 369

how to List all CONSTRAINTS of 2 tables at the same time?

I'm in need of a little bit of help. I know you can view constraints of 1 table at one time using the SQL Command function in the Oracle Apex Application Express 4.0.2.00.07. I want to know How I can modify the command below to view Constraints of my other tables as well within the same command. Is this possible? (e.g tblOrder, tblProduct)

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

If you can help I'd really appreciate it.

Upvotes: 0

Views: 2409

Answers (2)

Joachim Isaksson
Joachim Isaksson

Reputation: 180887

You can either just use IN, listing the tables;

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

...or since USER_CONSTRAINTS holds just the current user's tables, just plain list all constraints for all tables owned by the user by removing the WHERE entirely;

SELECT table_name, constraint_name, constraint_type 
FROM USER_CONSTRAINTS 

Upvotes: 1

Hamlet Hakobyan
Hamlet Hakobyan

Reputation: 33381

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

Upvotes: 1

Related Questions