653 | | LOCK TABLE %(table)s IN SHARE MODE; |
654 | | SELECT NVL(MAX(%(column)s), 0) INTO startvalue FROM %(table)s; |
655 | | SELECT "%(sequence)s".nextval INTO cval FROM dual; |
656 | | cval := startvalue - cval; |
657 | | IF cval != 0 THEN |
658 | | EXECUTE IMMEDIATE 'ALTER SEQUENCE "%(sequence)s" MINVALUE 0 INCREMENT BY '||cval; |
659 | | SELECT "%(sequence)s".nextval INTO cval FROM dual; |
660 | | EXECUTE IMMEDIATE 'ALTER SEQUENCE "%(sequence)s" INCREMENT BY 1'; |
661 | | END IF; |
662 | | COMMIT; |
| 653 | SELECT NVL(MAX(%(column)s), 0) INTO table_value FROM %(table)s; |
| 654 | SELECT last_number INTO seq_value FROM user_sequences |
| 655 | WHERE sequence_name = '%(sequence)s'; |
| 656 | WHILE table_value > seq_value LOOP |
| 657 | SELECT "%(sequence)s".nextval INTO seq_value FROM dual; |
| 658 | END LOOP; |