Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Getting Primary Key Info. for a table

Re: Getting Primary Key Info. for a table

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Mon, 28 Aug 2000 10:15:37 +0200
Message-ID: <8od75q$bbv$1@s1.read.news.oleane.net>

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...

> 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.
Received on Mon Aug 28 2000 - 03:15:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US