해나아부지 개발일지

OrcaleDB 11g sequence auto_increment 초기화 방법 본문

Developers/OracleDB

OrcaleDB 11g sequence auto_increment 초기화 방법

__APPA 2021. 2. 5. 09:39
SQL> SELECT LAST_NUMBER FROM USER_SEQUENCES WHERE SEQUENCE_NAME = '시퀀스명';

NEXTVAL
-------
13

SQL> alter sequence 시퀀스명 increment by -13 minvalue 0;

Sequence altered.

SQL> select s.nextval from dual;

   NEXTVAL
----------
         0

SQL> alter sequence s increment by 1;

Sequence altered.

SQL> select s.nextval from dual;

   NEXTVAL
----------
         1
Comments