Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: relationship between unique index and constraint
I belive it is that when you create a primay key it creates a unique index
and NOT NULL constraint. Unique indexes do not enforce NOT NULL.
-----Original Message-----
Sent: Friday, April 18, 2003 12:27 PM
To: Multiple recipients of list ORACLE-L
List,
If I create a unique index does Oracle create the unique constraint?
Example:
sql>create unique index name
on dept(dname);
index created.
sql>select constraint_name from user_constraints;
no rows selected.
sql>insert into dept(deptno, dname, loc) values(99,'SALES', 'DALLAS');
ORA-00001: unique constraint (djehres.dname) violated.
sql>select constraint_name from user_constraints;
no rows selected.
Question: If Oracle does not create a unique constraint ( does not show up in user_constraints) when you create a unique index how do you end up with a UNIQUE CONSTRAINT VIOLATED error?
thanks,
David Ehresmann
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Ehresmann, David
INET: David.Ehresmann_at_ps.net
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Fri Apr 18 2003 - 13:26:47 CDT