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!

Why a table can have only one PK ?

OraDBA02Jun 20 2010 — edited Jun 20 2010
Just wanted to know the reason why Oracle allows only one PK per table ?

I came across a situation where my existing large PK which is on a single (ID) column needs an alteration to add a new column (No).
ID column on which PK is based is now subjected to have duplication and that is the reason why i want to add a new column. The new column composition is not going to ensure uniqueness.
So, i need to create (alter) PK on two columns now.

It seems, in order to do that, i need to drop the existing PK and create a new one. Since this is a OLTP production database, business cannot afford to drop the existing pk.
When i tried to create a separate PK on two columns, Oracle gave me below err:
ORA-02260: table can have only one primary key
So, i wanted to understand why Oracle allows only one PK / table ? and considering above err, is there any way to make required changes to my PK without altering existing PK?
(Table is a large 30 GB partition table and PK is a non partitioned global index)

I think PROBABLY i need to drop existing PK and re-create the new one. But core intention for opening this thread is to know rational behind one pk/table concept.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2010
Added on Jun 20 2010
5 comments
4,617 views