Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> constraint name: what for?
Hi,
Can anyone explain the user of a constraint name such as pk_employee in:
//specifies the primary key as a table constraint
create table employee (
id number(3),
name varchar2(30),
constraint pk_employee PRIMARY KEY (id)
);
or
// specifies the primary key constraint in the field (column constraint)
id number(3) constraint pk_employee PRIMARY KEY
Isn't it that Oracle autogenerates an identifier/constraint_name
if you do not specify it?
What is the use of specifying the constraint_name in such a case?
BTW, I learned that it is necessary to supply a constraint_name when specifying a PRIMARY KEY table constraint. How come that it is allowed in column constraints to skip the constraint_name, while in table constraints there will be an error saying that the datatype is undefined.
Thanks.
JErwynn
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Sat Mar 06 1999 - 18:30:29 CST
![]() |
![]() |