-
show PK,FK
I created a table with multiple and primary keys. How can i view my primary and foreign keys in a description of a table..?
-
View here:
select * from sys.all_constraints
where ...
Regards
Ben de Boer
-
Hi,
if by description you mean to use the describe command, then you can't.
you can use this query:
-----------------------------------------------
accept tab_name prompt "Enter Table Name: "
select table_name, constraint_name, constraint_type
from user_constraints
where constraint_type in ('P','R')
where table_name = '&tab_name';
-----------------------------------------------
If you want to know the columns involved in any constraint
simply query the user_cons_columns:
-----------------------------------------------
select constraint_name,column_name from user_cons_columns
where constraint_name = 'constraint_name'
order by constraint_name,column_name,position;
-----------------------------------------------
Cheers,
R.
It is better to ask and appear ignorant, than to remain silent and remain ignorant.
Oracle OCP DBA 9i,
C++, Java developer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|