| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Statement (Columns with primary key)
I haven't tested this, but I think it might work if you correct any typos. The
'select' statement in the 'from' clause will return all columns with a
constraint type = 'P'. An outer join to this statement by column name should
return all columns (identifying those with a primary key)
SELECT Sys.All_Tab_Columns.Table_Name,
Sys.All_Tab_Columns.Column_Name,
Con.Constraint_Name
FROM Sys.All_Tab_Columns,
(Select Sys.All_Cons_Columns.Column_Name,
Sys.All_Constraints.Constraint_Name
from Sys.All_Cons_Columns,
Sys.All_Constraints
where Sys.All_Constraints.Constraint_Name =
Sys.All_Cons_Columns.Constraint_Name
and Sys.All_Constraints.Constraint_Type = 'P') Con
WHERE Sys.All_Tab_Columns.Column_Name =
Con.Column_name (+)
Received on Thu Sep 10 1998 - 20:18:17 CDT
![]() |
![]() |