I have primary keys in my database which are of NVARCHAR2 type. By default data is inserted into these columns as case sensitive which means insertion of both 'ABCD' and 'Abcd' are allowed.
Can I change the settings in Oracle so that the primary keys work case in-sensitively? I wanted Oracle to throw an error if someone is inserting 'Abcd' and if there is already a record with primary key 'ABCD'.
Note: I am using Entity Framework.
Case In-Sensitive primary key (NVARCHAR2 datatype) in Oracle
-
- Posts: 4
- Joined: Mon 06 Jul 2009 10:33
Justin and Mark replied to your question here:
http://forums.oracle.com/forums/thread. ... dID=937377
As they said, you have two alternatives - either to create unique case-insensitive constaint on the primary key column,
or to create an insert trigger that will compare the new primary key value cast to upper case with all values of the
primary key column also cast to upper case.
Anyway, this constraint is to be implemented on the server side.
http://forums.oracle.com/forums/thread. ... dID=937377
As they said, you have two alternatives - either to create unique case-insensitive constaint on the primary key column,
or to create an insert trigger that will compare the new primary key value cast to upper case with all values of the
primary key column also cast to upper case.
Anyway, this constraint is to be implemented on the server side.