db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamatha Kodigehalli Venkatesh" <Mamatha.Venkat...@ness.com>
Subject RE: Unique or primary key constraint error while BULK import back into table after BULK export
Date Mon, 10 May 2010 11:21:34 GMT


Any help appreciated on this.


My table ('TIDLGGLS') that has Varchar field say has values ("hello") and ("hello   ") in
the column (test).

Step1: I do a bulk export on this table.

Step2:  Try Bulk import...

            I end up in an exception ....

WARNING: Error in updating the Database Import error on line 48,917 of file D:\test\TestDBUpg/TIDLGGLS_data.dat:
The statement was aborted because it would have caused a duplicate key value in a unique or
primary key constraint or unique index identified by 'TIILGGLS' defined on 'TIDLGGLS'.

'TIILGGLS' is my unique index created on this column (test).

'TIDLGGLS' is my table.


How can I come out of this problem?






From: Mamatha Kodigehalli Venkatesh [mailto:Mamatha.Venkatesh@ness.com] 
Sent: Friday, May 07, 2010 5:45 PM
To: Derby Discussion
Subject: Unique or primary key constraint error while BULK import back into table after BULK




In derby when we export a data table which contains same value ("hello") and another ("hello
 ") where there is only difference in the space using BULK EXPORT.

When you go back and import the exported data, you get a unique constraint error.


As this table contains the unique constraint on the table on the column of the represented


Below is the test data of the table executed in ij.




create table companies (name VARCHAR(50) not null);

CREATE UNIQUE INDEX varcharcompaniesIndx on companies (name);


insert into companies values ('NESS') ;

insert into companies values ('NESS  ') ;


RESULT : NO ERROR in derby and oracle



create table chartestme(name CHAR(50) not null);

CREATE UNIQUE INDEX chartestmeIndx on chartestme (name);

insert into chartestme values ('HELLO') ;

insert into chartestme values ('HELLO  ') ;



RESULT : NO ERROR in derby... wheras oracle throws unique constraint



select name, length(name) from companies

select name, length(name)  from varchartable


Question :  Oracle throws an unique constraint error during insert only if the datatype is
Char. Why the same behaviour is not observed in derby when the datatype is char.





View raw message