Hello,

 

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 table..

 

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

 

TABLE WITH VARCHAR

 

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

 

TABLE WITH CHAR

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.

 

 

Thanks

Mamatha