Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Naming DEFAULT constraints

Re: Naming DEFAULT constraints

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 26 Jan 2007 09:22:19 -0800
Message-ID: <1169832137.179450@bubbleator.drizzle.com>


Paul wrote:
> Hi,
>
> I am attempting to rename all of the DEFAULT constraints in a database
> so that they have controlled names (i.e. not system generated one).
>
> My plan was to find the system generated name, drop the constraint then
> recreate it.
>
> I cannot seem to find a way of creating a named default constraint on a
> colum.
>
> I have tried:
>
> ALTER TABLE <TABLE NAME>
> ADD CONSTRAINT DF1_<TABLE NAME> DEFAULT <VALUE> (<COLUMN>);
>
> This fails
>
> I have also tried:
>
> ALTER TABLE <TABLE_NAME>
> MODIFY
> (<COLUMN_NAME> DEFAULT DF1<TABLE_NAME> <VALUE>;
>
> Neither work and I am unsure why.
>
> Does anybody know if this is possible and if so how I can acheive it.
> It is not good enough just to be able to rename the existing constraint
> as I need to be able to add new named ones in the future.
>
> If anybody can suggest anything it would be greatly appreciated.
>
> Thanks in advance,
>
> Paul

And this syntax won't work?

ALTER TABLE person
RENAME CONSTRAINT pk_person
TO person_pk;

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Jan 26 2007 - 11:22:19 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US