Home » SQL & PL/SQL » SQL & PL/SQL » constraint type
constraint type [message #200044] Fri, 27 October 2006 11:38 Go to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
hello orafaq team,
i m getting constraint_name as below-
select owner, constraint_name, constraint_type
from USER_CONSTRAINTS
where table_name='EMP1';

OWNER CONSTRAINT_NAME C
------------------------------ ------------------------------ -
SCOTT SYS_C002790 C
SCOTT SYS_C002795 P

but I need constraint_name as pk or pr_no why I m geeting sys_C002790?

with regards
ashish
Re: constraint type [message #200065 is a reply to message #200044] Fri, 27 October 2006 13:58 Go to previous messageGo to next message
navkrish
Messages: 189
Registered: May 2006
Location: NJ,USA
Senior Member

If you are not explicitly mentioning the constraint name, oracle will take the default name starting with string SYS_

Naveen
Re: constraint type [message #200072 is a reply to message #200065] Fri, 27 October 2006 14:18 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

create table test
( no number, name varchar2(20) constraint no_pk primary key(no));

and check user_constraints and user_cons_columns views.

This time oracle will not generate SYS_ default name but it will show user defined name.
Re: constraint type [message #200105 is a reply to message #200072] Fri, 27 October 2006 21:05 Go to previous messageGo to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
Thanks for your response


With regards
ashish Cool
Re: constraint type [message #200312 is a reply to message #200044] Mon, 30 October 2006 05:54 Go to previous message
ajaybabu.yaleti
Messages: 11
Registered: October 2006
Junior Member
Hi,

while creating the table specify the constraint name .

eg: create table tablename (col1 number pk_no primary key,
col2 varchar2(30));

Regards,
Ajay
Previous Topic: Problem with Oracle Stored Proc - PLS-00306: wrong number or ...
Next Topic: urgent again.... please help..
Goto Forum:
  


Current Time: Mon Dec 05 07:02:15 CST 2016

Total time taken to generate the page: 0.08856 seconds