Home » SQL & PL/SQL » SQL & PL/SQL » update sequence values
update sequence values [message #10019] Mon, 22 December 2003 11:29 Go to next message
MM
Messages: 27
Registered: July 2002
Junior Member
I have a table which has a line_no field and this field is being incremented by a numeric value. It has about 2 million rows. Further any inserts into this table i want to use a Oracle generated sequence for the line_no field. I have created a sequence and using it against the new entries.

I need to update the old values of line_no to use the sequence number. I can do this by issuing an update statement based on key values. As update may take longer for 2 million rows, IS there any other options i can achieve this?

Any inputs appreciated
Thanks,

MM
Re: update sequence values [message #10020 is a reply to message #10019] Mon, 22 December 2003 13:51 Go to previous messageGo to next message
William Robertson
Messages: 1643
Registered: August 2003
Location: London, UK
Senior Member
You could try setting the CACHE value of the sequence to a bigger value than the default (20), e.g. 100000 - you can always set it back later.
Re: update sequence values [message #10028 is a reply to message #10020] Tue, 23 December 2003 06:41 Go to previous messageGo to next message
MM
Messages: 27
Registered: July 2002
Junior Member
By creating the sequence with a higher cache as 100000 how do i update the previous values in line_no feild which was not part of the sequence number generation to use the current sequence pattern?
Can you explain me in detail?

Thanks

MM
Re: update sequence values [message #10029 is a reply to message #10028] Tue, 23 December 2003 10:19 Go to previous message
William Robertson
Messages: 1643
Registered: August 2003
Location: London, UK
Senior Member
How about
<pre style="color: navy;">UPDATE yourtable
SET col = yourseq.NEXTVAL
WHERE col IS NULL;</pre>
Previous Topic: Procedure
Next Topic: Which is faster - update or a delete/insert combination
Goto Forum:
  


Current Time: Fri Apr 26 06:12:46 CDT 2024