dbTalk Databases Forums  

Function bases index / conatrint - confused

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Function bases index / conatrint - confused in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin T.
 
Posts: n/a

Default Function bases index / conatrint - confused - 11-10-2006 , 06:01 AM






Hi all.
(Oracle 9i2)

I have a name column that up to now had a unique index+constraint to
prevent the same names.
I wanted to change this, so that the names get compared
case-insensitive.

I can use a function base index to achive this:
CREATE UNIQUE INDEX MYTABLE_C1 ON MYTABLE
(LOWER(NAME));

However, prior to now I had the following:
CREATE UNIQUE INDEX MYTABLE_C1 ON MYTABLE
(NAME);
ALTER TABLE MYTABLE ADD (
CONSTRAINT MYTABLE_C1 UNIQUE(NAME)
USING INDEX);

But I cannot create a constraint on lower(..)
I have found quite a few examples on the net which explain to use a
function based index to enforce similar constraints.

So what problems can arise if I set only a fbi and not also the
explicit constraint?

thanks for any pointers.

best regards,
Martin


Reply With Quote
  #2  
Old   
Mark D Powell
 
Posts: n/a

Default Re: Function bases index / conatrint - confused - 11-10-2006 , 08:45 AM








On Nov 10, 7:01 am, "Martin T." <bilbothebagginsb... (AT) freenet (DOT) de>
wrote:
Quote:
Hi all.
(Oracle 9i2)

I have a name column that up to now had a unique index+constraint to
prevent the same names.
I wanted to change this, so that the names get compared
case-insensitive.

I can use a function base index to achive this:
CREATE UNIQUE INDEX MYTABLE_C1 ON MYTABLE
(LOWER(NAME));

However, prior to now I had the following:
CREATE UNIQUE INDEX MYTABLE_C1 ON MYTABLE
(NAME);
ALTER TABLE MYTABLE ADD (
CONSTRAINT MYTABLE_C1 UNIQUE(NAME)
USING INDEX);

But I cannot create a constraint on lower(..)
I have found quite a few examples on the net which explain to use a
function based index to enforce similar constraints.

So what problems can arise if I set only a fbi and not also the
explicit constraint?

thanks for any pointers.

best regards,
Martin
Since in version 9.2 the FBI will provide the functionality you want I
do not see any problem other than because you do not have a constraint
defined other than you will not be able to see the "constraint" by
querying DBA_CONSTRAINTS.

HTH -- Mark D Powell --



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.