I have a (Oracle) sequence that I use to assign an order number to new orders being inserted into a database table. It started at 1, and increments by 1 for each new order.
I have a new requirement saying that order numbers should start at 10000000 (ten million), so I want to update all existing records (by adding 10000000; order 1 will then be 10000001, order 7002 will be 10007002, etc), and also increment the Oracle sequence so that the next value will be correct.
I was going to simply run this script:
DECLARE
l_temp NUMBER;
BEGIN
FOR idx IN 1..10000000 LOOP
SELECT MY_ORDER_SEQ.nextval
INTO l_temp
FROM dual
;
END LOOP;
END;
/
but I don't really know how long that would take to run.
Is there a better way to do this?