View Full Version : How to make unique constrant on a column case-INsensitive in Oracle 9
Genna
10-14-2005, 01:08 PM
I have a task:
set unique constraint on a table column but I don't care about case
sensitivity. How to implement it? I know Oracle 10 has NLS_SORT=xxxx_CI
setting with 'CI' suffix that is 'Case Insensitive' just to address the
issue. But I need to solve this for Oracle 9.
Thanks in advance.
Genna.
IANAL_VISTA
10-14-2005, 06:05 PM
"Genna" <gralko@gmail.com> wrote in
news:1129324111.358555.207850@g44g2000cwa.googlegroups.com:
I have a task: set unique constraint on a table column but I don't care about case sensitivity. How to implement it? I know Oracle 10 has NLS_SORT=xxxx_CI setting with 'CI' suffix that is 'Case Insensitive' just to address the issue. But I need to solve this for Oracle 9. Thanks in advance. Genna.
Use either UPPER() or LOWER() functions in the WHERE clause
Genna
10-24-2005, 06:45 AM
thx for your comment. it's actually the way I have it implemented right
now. added this UPPER() check in a table trigger and made it fire a
custom error. Does anybody know a nicer and more efficient way to do
this case-INsensitive unique constraint on a table column (not the
whole table or database).
Sybrand Bakker
10-29-2005, 02:03 AM
On 24 Oct 2005 07:45:37 -0700, "Genna" <gralko@gmail.com> wrote:
thx for your comment. it's actually the way I have it implemented rightnow. added this UPPER() check in a table trigger and made it fire acustom error. Does anybody know a nicer and more efficient way to dothis case-INsensitive unique constraint on a table column (not thewhole table or database).
An ordinary check constraint would do. CHECK (column = UPPER(column))
--
Sybrand Bakker, Senior Oracle DBA
Marek Läll
11-05-2005, 03:12 PM
create a unique function-base index:
create index <name> on <table> (upper(<column>))
regards,
Marek.
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.