|
|
|
|
Re: I am facing a problem during INSERT operation its giving Unique Constraint Error. [message #383301 is a reply to message #383258] |
Wed, 28 January 2009 02:55  |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
natrajdreams wrote on Wed, 28 January 2009 07:49 | I am facing a problem during INSERT operation its giving Unique Constraint Error.
I want tdo the following:
INSERT INTO TABLEB(COL1,COL2)
SELECT COL1,COL2 FROM TABLEA
How to get rid of the duplicate rows while inserting so that if there 22 rows and of those 3 are duplicates it will insert 19 rows into TABLEB
|
It is your data. You know the column(s) this unique constraint is built on; but you did not find important to post it. Also stating "duplicates" is also related to certain column(s) - as you did not specify them, Littlefoot understood it as duplicate in all its columns (which is probably not right according to http://forums.oracle.com/forums/thread.jspa?threadID=852288&tstart=0).
It is your data. You should know, which rows should be inserted and which should not.
Just an example: let's say, that COL1 is unique, both columns are numeric and you want to insert following rows: COL1 COL2
---- ----
1 2
1 5
1 1
Which row (only one can be inserted without breaking unique constraint) should be inserted and why?
|
|
|