0

I have a ORACLE DB and when i try inserting "INDIA" and "india" as values into column which is carrying unique constraints on it , it is allowing the value to insert .

It looks like case sensitive options should be enabled in the Db , But not able to figure out where to do that so that it will not allow values with the same name either small / capital letters.

Regards Chenna B.


But I have many columns which need to be updated in the same , so instead of that , can i change parameter at DB level which will not allow of that sort in any columns

1
  • 1
    I think you want to insert 'INDIA' and 'india'. Strings are enclosed by single apostrophes.
    – miracle173
    Commented Mar 27, 2014 at 7:47

2 Answers 2

1

Use a unique function-based index:

CREATE UNIQUE INDEX countryname_unique ON country (LOWER(countryname));

Much better than messing with collations.

2
  • But I have many columns which need to be updated in the same , so instead of that , can i change parameter at DB level which will not allow of that sort in any columns
    – user35053
    Commented Mar 27, 2014 at 10:45
  • Do you really want all unique constraints in your entire database to be enforced in a case-insensitive way? Scary. I can only begin to imagine all of the things that would break. Commented Jun 2, 2014 at 9:38
0

Your options are function based indexes, virtual columns(if you are using 11g version), triggers, application changes...

But there is no simple switch to accomplish what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.