Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Getting Primary Key Info. for a table
You'll find this information in user_constraints and user_cons_columns views.
For instance:
select col.column_name
from user_cons_columns col, user_constraints cons
where col.owner = cons.owner
and col.constraint_name = cons.constraint_name
-- and cons.owner = user
and cons.table_name = <your table>
and cons.constraint_type = 'P'
order by col.position
-- Have a nice day Michel <adnanbader_at_my-deja.com> a écrit dans le message : 8ocpha$1e6$1_at_nnrp1.deja.com...Received on Mon Aug 28 2000 - 03:15:37 CDT
> Hi,
>
> It sounds a very basic question, but not being a
> DB expert I would like to throw the question in
> this forum and seek any quick help. I want to get
> the primary keys information about a table in
> Oracle DB using either an SQL query or any other
> suitable method for an OLE DB consumer
> application. I'm trying to write the consumer in
> VC++ with OLE DB Provider interface and at the
> beginning of application execution there is no
> information available about the table. But as
> 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.
>
> Cheers.
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.