Skip to Main Content

SQL & PL/SQL

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!

Add constraint 0ra-02299

AhmedDec 11 2010 — edited Dec 14 2010
Table has many records, some records are also duplicate (vm_no,vm_date)
now I am adding a constraint
SQL> alter table vouchermaster
  2  add constraint un_vm_vd unique (vm_no,vm_date);
add constraint un_vm_vd unique (vm_no,vm_date)
               *
ERROR at line 2:
ORA-02299: cannot validate (UN_VM_VD) - duplicate keys found
First time I am using UN_VM_VD constraint name

when I check my table duplicate records
SQL> select vm_no,vm_date from vouchermaster
  2  group by vm_no,vm_date
  3  having count(1) >1;

     VM_NO VM_DATE
---------- ---------
         5 18-MAY-10
         7 19-MAY-10
        18 19-MAY-10
        38 24-MAY-10
guide me can I add constraint Unique or primary key without data lose with force.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2011
Added on Dec 11 2010
4 comments
4,916 views