Oracle

Sequence

Figo Kim 2006. 11. 25. 21:54
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
  • Can automatically generate unique numbers
  • Is a sharable object
  • Can be used to create a primary key value
  • Replaces application code
  • Speeds up the efficiency of accessing sequence values when cached in memeory

Syntax

CREATE SEQUENCE sequence
[INCREMENT BY n]
[START WITH n]
[{MAXVALUE n | NOMAXVALUE}]
[{MINVALUE n | NOMAXVALUE}]
[{CYCLE | NOCYCLE}]
[{CACHE n | NOCACHE}];

default increment value : 1
maxvalue : 10^27 (default)
minvalue : - 10^26 (default)
no cache : default
By default, the Oracle server caches 20 values

Ex)
CREATE SEQUENCE     dept_deptid_seq
                                  INCREMENT BY 10
                                  START WITH 120
                                  MAXVALUE 9999
                                  NOCACHE
                                  NOCYCLE;


** Do not use the CYCLE option if the sequence is used to generate primary key value, unless you have a reliable mechanism that purges old rows faster than sequence cycle.

'Oracle' 카테고리의 다른 글

NEXTVAL and CURRVAL Pseudocolumns : Rules  (0) 2006.11.25
NEXTVAL and CURRVAL Pseudocolumns : Rules  (0) 2006.11.25
Sequence  (0) 2006.11.25
Denying DML Operations & Removing a View  (0) 2006.11.24
Denying DML Operations & Removing a View  (0) 2006.11.24