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 -> Inserting a new PK into an existing table

Inserting a new PK into an existing table

From: Jens Lenge <spampot_at_gmx.net>
Date: 31 Aug 2006 08:46:45 -0700
Message-ID: <1157039205.406218.68740@i3g2000cwc.googlegroups.com>


Hello world,

I want to add a new numeric column "id" into an existing table that is intended to be the new primary key. As the table already contains data, I need to fill the "id" column with distinct values before I can make it the new primary key.

I have looked for SQL commands to add the new column and fill it with a series of values like 1, 2, 3, ..., but have not found something like that. As I am quite new to SQL, I have also read a number of tutorials, but found no hint on the topic.

Now I am curious how this is "normally" done. Can it be done with "plain" SQL or do I need extensions like PL/SQL?

Jens Received on Thu Aug 31 2006 - 10:46:45 CDT

Original text of this message

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