I have some inserts in a development environment to release, the developer has not used sequences to obtain the correct identifiers when doing inserts. What he has done is gone into the production database and found out what the largest identifier is and added a few hundred numbers to it. To boot he has now left the company.
So the script to prod is filled with hundreds of these:
INSERT INTO table (sequencecol, cola, colb) VALUES (90001,'test','test');
INSERT INTO childtableB (foreignkeyTableA, cola) VALUES (90001,'test')
When it should have been
INSERT INTO tableA (sequencecol, cola, colb) VALUES (tablesequence.NEXTVAL,'test','test');
INSERT INTO childtableB (foreignkeyTableA, cola) VALUES (tablesequence.CURRVAL,'test')
The scneario i am dealing with is more complicated than this, and i dont have the time to rewrite, instead i just want to set the sequence to the max value of the records inserted as part of this script.
Is it possible to alter the value of a sequence to set it to the value of the highest value +1 of the records i am to insert?
I'm open to better suggestions