'database/ORACLE'에 해당되는 글 93건

  1. 2012.06.19 오라클 SEQUENCE

오라클 SEQUENCE

database/ORACLE 2012. 6. 19. 15:04
반응형

SQL> CREATE SEQUENCE SQ_GXX001  START WITH 1 INCREMENT BY 1 MAXVALUE 999999999 CYCLE ORDER CACHE 10;

Sequence created.


SQL> select SQ_GXX001.nextval from dual;

   NEXTVAL
----------
         1

SQL> select SQ_GXX001.nextval from dual;

   NEXTVAL
----------
         2

SQL> select SQ_GXX001.nextval from dual;

   NEXTVAL
----------
         3

SQL> select SQ_GXX001.nextval from dual;

   NEXTVAL
----------
         4

SQL>  select SQ_GXX001.nextval from dual;

   NEXTVAL
----------
         5

SQL>  select SQ_GXX001.nextval from dual;

   NEXTVAL
----------
         6
SQL> select SQ_GXX001.nextval from dual;

   NEXTVAL
----------
         7

SQL> select SQ_GXX001.currval from dual;

   CURRVAL
----------
         7

SQL> select SQ_GXX001.currval from dual;

   CURRVAL
----------
         7

SQL> select SQ_GXX001.currval from dual;

   CURRVAL
----------
         7

SQL> select SQ_GXX001.currval from dual;

   CURRVAL
----------
         7

SQL> select SQ_GXX001.currval from dual;

   CURRVAL
----------
         7

SQL> select SQ_GXX001.currval from dual;

   CURRVAL
----------
         7

 

:

:

:

;

;

 

 

 

SQL> SELECT * FROM USER_SEQUENCES;

 

 

SEQUENCE_NAME                   MIN_VALUE  MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER
------------------------------ ---------- ---------- ------------ - - ---------- -----------
SQ_GXX001                               1  999999999            1 Y Y         10          11

 

 

 

SQL> drop SEQUENCE SQ_GXX001;

Sequence dropped.

 

 

SQL> SELECT * FROM user_sequences;

no rows selected

 

 

 

반응형
Posted by 공간사랑
,