DB2 V7.2 에 새로 추가된 오브젝트로 시퀀스가 있습니다.
저도 사용을 해 보지 않아서 아래의 자료를 참조하시기 바랍니다.
| CREATE SEQUENCE order_seq
| START WITH 1
| INCREMENT BY 1
| NOMAXVALUE
| NOCYCLE
| CACHE 24
In this example, the sequence is called order_seq. It will start at 1 and
increase by 1 with no upper limit. There is no reason to cycle back to the beginning and restart from 1 because there is no assigned upper limit. The number associated with the CACHE parameter specifies the maximum number of sequence values that the database manager preallocates and keeps in memory.
The sequence numbers generated have the following properties:
* Values can be any exact numeric data type with a scale of zero. Such data types include: SMALLINT, BIGINT, INTEGER, and DECIMAL.
* Consecutive values can differ by any specified integer increment.
The default increment value is 1.
* Counter value is recoverable. The counter value is reconstructed
from logs when recovery is required.
* Values can be cached to improve performance. Preallocating and
storing values in the cache reduces synchronous I/O to the log when values are generated for the sequence. In the event of a system
failure, all cached values that have not been committed are never
used and |considered lost. The value specified for CACHE is the
maximum number of sequence values that could be lost.
-- JIN 님이 쓰신 글:
>> identity column말고
>> 오라클의 시퀀스같이
>> 생성하고 어느곳에든 사용할수 있는 그런게 있을것같은데
>> 어떻게 만들고 어떻게 사용하는지요..
|