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: updating a primary key ???

Re: updating a primary key ???

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 22 Mar 2002 21:33:11 +0000
Message-ID: <3C9BA317.611@yahoo.com>


Howard J. Rogers wrote:
>
> Oracle certainly permits it. It's just a regular, boring old update
> statement.
>
> Try doing an update emp set empno=9999 where empno=7934; on the infamous EMP
> table of Scott's (which has empno as its primary key. No problems.
>
> Regards
> HJR
> --
> ----------------------------------------------
> Resources for Oracle: http://www.hjrdba.com
> ===============================
>
> "Brian" <boneill_at_calpoly.edu> wrote in message
> news:3c9b8bcf$1_2_at_news.nntpserver.com...
> > Hello,
> >
> > My question is whether or not is okay to update a primary key
> > value as long as it is still unique (assuming no foreign key relations).
> > Do most databases allow this, or is it necessary to delete the old
> > record and re-insert with the new primary key?
> >
> > TIA,
> > Brian
> >
> >

and just to add for our original poster - if you *do* have any dependencies then you may wish to consider deferred primary key constraints to allow an update-cascade type of operation

hth
connor

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Fri Mar 22 2002 - 15:33:11 CST

Original text of this message

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