Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SQL Statement
Hi,
How can I write a statement that returns list of all columns in a database and if any column a primary key or not. I trying:
SELECT Sys.All_Tab_Columns.Table_Name,
Sys.All_Tab_Columns.Column_Name, Sys.All_Cons_Columns.Constraint_Name, Sys.All_Constraints.Constraint_Type FROM Sys.All_Tab_Columns, Sys.All_Cons_Columns, Sys.All_Constraints
Sys.All_Constraints.Constraint_Name (+) = Sys.All_Cons_Columns.Constraint_Name AND Sys.All_Constraints.Constraint_Type (+) = 'P'
but its works wrong because its list some columns twice or more
(some different constraints refers to the same columns).
So, how can I limit this statement and except columns reduplication. Or may be exists an other idea?
Thanks in advance. Received on Wed Sep 02 1998 - 11:00:02 CDT
![]() |
![]() |