Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Adding an id column to an existing table

561854May 27 2008 — edited Mar 4 2009
I would like to add an id column to an existing table and populate this column for the existing records. For any new inserts I would like to use the next id in sequence.

I believe a sequence and a trigger on insert would be the best way to accomplish the second requirement. I would like to know how to do the first, i.e. handle the existing rows given that I will be using a sequence and trigger for all subsequent rows.

I've never created sequences or triggers before so any advice would be appreciated.

-=beeky
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2009
Added on May 27 2008
6 comments
24,502 views