Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

identifying composite primary keys

BSalesRashidJun 29 2012 — edited Jun 29 2012
Hi fellows,

I am trying to identify an unique value in a particular table, so then i tried to look for primary key constraints in the table:

11:54:07 brunos@vvp> select owner,constraint_name, constraint_type, index_name from dba_constraints where table_name='CARD_TRANSACTIONS';

OWNER CONSTRAINT_NAME CONSTRAINT_TYPE INDEX_NAME
------------------------------ ------------------------------ --------------- ------------------------------
VVP PK_CARD_TRANSACTIONS P PK_CARD_TRANSACTIONS


So then i looked at dba_cons_columns :

11:56:22 brunos@vvp> select * from dba_cons_columns where constraint_name='PK_CARD_TRANSACTIONS';

OWNER CONSTRAINT_NAME TABLE_NAME COLUMN_NAME POSITION
------------------------------ ------------------------------ ------------------------------ --------------------------------------------------
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS CARD 4
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS COUNTER 3
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS OPERATION 2
VVP PK_CARD_TRANSACTIONS CARD_TRANSACTIONS STATUS 1



I understand that in one table we only have 1 PK only. Is this a composite primary key? I was expecting to see only 1 value, and then it showed me 4.


Thanks in advance.

Edited by: BSalesRashid on 29/06/2012 07:58
This post has been answered by Ahmer Mansoor on Jun 29 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2012
Added on Jun 29 2012
6 comments
2,688 views