Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Godwin.

Asked: August 27, 2004 - 11:42 am UTC

Last updated: August 27, 2004 - 11:42 am UTC

Version: 9.2.0.2

Viewed 1000+ times

You Asked

Hi Tom,
Is there any problem that one might encountered when one rely on system's genereated constraints verse user-named constraints on created database tables.
For example: create table emp(id number primary key pk_empid,
name varchar2(40) not null);
verse

create table emp(id number primary key,
name varchar2(40));
which one do you prefer for use: user-named constraints or system generated constraints? what are the implications?
Best regards!


and Tom said...

i would definitely name all nameable constraints. it only makes sense.

with import/export you can get duplicates easily if you let the system name them.

also, what is more meaningful to your end users/developers:


insert into t values ( 1 )
*
ERROR at line 1:
ORA-00001: unique constraint (OPS$TKYTE.SYS_C009072) violated


or

insert into t values ( 1 )
*
ERROR at line 1:
ORA-00001: unique constraint (OPS$TKYTE.T_PK) violated



name them!


Is this answer out of date? If it is, please let us know via a Comment