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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Renaming PK constraints, indexing existing tables

Re: Renaming PK constraints, indexing existing tables

From: <handy_solo_at_my-deja.com>
Date: Fri, 12 Jan 2001 16:17:11 GMT
Message-ID: <93nals$iht$1@nnrp1.deja.com>

In article <3a5e4372.194400344_at_news.alt.net>,   SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK (Brian Tkatch) wrote:
> >Uh oh. So... hmm... to rename these suckers I take it I'm going to
> >have to rebuild the tables with the appropriate constraint clause
 with
> >a readable name, eh?
> >Rats.
> >
> I don't believe so. I have successfully renamed quite a few Primary
> Keys.
>
> ALTER TABLE Cow DROP C_Moo_PK;
> ALTER TABLE Cow ADD CONSTRAINT C1_Moo_PK PRIMARY KEY (Moo);

Yep - finally got that squared away. For some reason I was thinking column constraints, not table constraints. Once I got that mental blockage cleared it became a little simpler!

>
> Of course if any Foreign Keys reference this key, you might want to go
> get a couple aspirin.

Yeah... I hear that. My script goes through and drops ALL the constraints first (in the proper order of course) then creates the necessary indexes and then re-adds the constraints.

Almost done and looking like I'll live through this.

Thanks all for the help!

>
> Brian
>

Sent via Deja.com
http://www.deja.com/ Received on Fri Jan 12 2001 - 10:17:11 CST

Original text of this message

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