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

Home -> Community -> Usenet -> c.d.o.misc -> Re: change the primary key

Re: change the primary key

From: Andrew Allen <ajallen_at_mailhost.det.ameritech.net>
Date: Sat, 08 Sep 2001 01:12:30 GMT
Message-ID: <3B99709F.16D6C9BC@mailhost.det.ameritech.net>


flora wrote:
>
> in oracle7, using sql*plus, if i want to change the primary key how can i do
> that? for example i have already created a table with primary key of
> "customer_name", and now i want to make "customer_id" the primary key. or i
> want to add a column named "customer_id" to be the primary key...

  1. alter table foo drop primary key;
  2. create unique index foo_pk on foo(customer_id) tablespace . . . . ;
  3. alter table foo add constraint foo_pk primary key (customer_id) using index;
-- 
Andrew Allen
E- Mailto:ajalle_at_ameritech.net
Received on Fri Sep 07 2001 - 20:12:30 CDT

Original text of this message

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