Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Getting Primary Key Info. for a table
> soon as the user selects a table, I need to
> retrieve the primary key columns for that table.
>
> Any quick help or pointer are greatly appreciated.
>
Hello,
This statement will select for all tables the primary-keys which can be more than one for a table.
select
uc.TABLE_NAME, ucc.COLUMN_NAME, ucc.POSITION, uc.STATUS from user_cons_columns ucc, user_constraints uc where uc.constraint_type = 'P' and ucc.CONSTRAINT_NAME = uc.CONSTRAINT_NAME order by ucc.TABLE_NAME, ucc.POSITION;
Hope this will help you,
Regards, Stephan
-- --------------------------------------------------------------- Dipl.-Inf. (FH) Stephan Born | beusen Solutions GmbH fon: +49 30 549932-0 | Landsberger Allee 392 fax: +49 30 549932-21 | 12681 Berlin | Germany --------------------------------------------------------------- PGP-Key verfügbar | PGP-Key available ---------------------------------------------------------------Received on Mon Aug 28 2000 - 08:07:33 CDT