Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use of trigger within a procedure

Status
Not open for further replies.

mkey

Programmer
Oct 3, 2001
288
CA
Hi all,
Let say I have a table with data like this:

id id2 id3
100 12.5
200 13.5
300 15.4

Now What I want to do is update the id column with a sequance(start from 1). I know I could write a trigger on this table but my question is I'm not updatating anything else in this table except the id column. So I am not sure I could do this within a procedure. How can I achive this?

Thanks,
mkey!
 
To update this data as a one off, why don't you:

Create a sequence

Write a pl/sql block which loops through the records in the table extracting the primary key. Within the loop, update the id column with the nextval of the sequence using the primary key of the row.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top