You may come across a situation where you have to put Primary key on a column in table that is having duplicate rows and you cannot delete the duplicate rows.
Now this is a tricky situation.....below is the solution for the above problem.
for example you have to put primary key on "B column" "on ABC table" that is having duplicate values.
1) create index ABC_B_INX on B tablespace ABC;
2) alter table ABC add constraint ABC_B_PK primary key(B) disable;
3) alter table ABC enable novalidate constraint ABC_B_PK;
Hope this helps.....
Sunday, October 18, 2009
How to enable primary key on a column having duplicate values in oracle database
Labels:
database,
oracle,
primary key,
table
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment