Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find primary keys?
Tim Spellman wrote:
>
> I would like a list of all the primary key columns in all my tables.
> I'm
> thinking of something simple like
>
> select table_name, column_name from cols where <what is the condition?>;
The table is not cols it is user_cons_constraints. The description is:
OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME and POSITION (if your primary key is make with two or more columns). You can do a join with user_constraints from get only the primarys and not the foreign or the other type of constraints.
HTH: Elisa Received on Thu Apr 03 1997 - 00:00:00 CST