1. sequence definition
ORACLE:
Create sequence <sequence_name>
Increment by <integer>
Start with <integer>
Maxvalue <integer>/nomaxvalue
Minvalue <integer>/nominvalue
Cycle/nocycle
Cache <#>/nocache
Order/noorder;
DB2:
Create sequence <sequence-Name>
As data-type default as integer
Start with <Numeric-constant>
Increment by <Numeric-constant> default value: increment by 1
Minvalue <Numeric-constant> | no minvalue defaults to no minvalue.
Maxvalue <Numeric-constant> | no maxvalue default value: No maxvalue
No cycle | no cycle by default
Cache <Numeric-constant> | no cache default cache 20
No order | order no order by default
2. Sequence values
Take the following value:
ORACLE: sequence. nextval
DB2: nextval for sequence or next value for sequence
Take the current value:
ORACLE: sequence. currval
DB2: previous value for sequence or prevval for sequence
3. Set the sequence start value
ORACLE: Get the next value. First set the step size (the difference between the next value and the set start value); then change the step size to the original value.
DB2: Alter sequence name restart with next value
3. Modify
ORACLE:
Alter maximum alter sequence <sequence_name> max value <integer>
Minimum value: Alter sequence <sequence_name> min value <integer> (This value must be smaller than the current value)
Modify the step size: Alter sequence <sequence_name> increment by <integer>;
Modify the cache value: Alter sequence <sequence_name> cache <integer> | nocache
Modify the cycle attribute: Alter sequence <sequence_name> <cycle | nocycle>
Modify the sorting attribute: Alter sequence <sequence_name> <order | noorder>
DB2:
Alter maximum alter sequence <sequence_name> max value <Numeric-constant> | no maxvalue
Minimum modification value: Alter sequence <sequence_name> min value <Numeric-constant> | no minvalue (This value must be smaller than the current value)
Modify the step size: Alter sequence <sequence_name> increment by <Numeric-constant>;
Modify the cache value: Alter sequence <sequence_name> cache <Numeric-constant> | no cache
Modify the cycle attribute: Alter sequence <sequence_name> <cycle | no cycle>
Modify the sorting attribute: Alter sequence <sequence_name> <order | no order>
New count: Alter sequence <sequence_name> restart | restart with <Numeric-constant>
3. Drop
ORACLE: drop sequence <sequence_name>;
DB2: drop sequence <sequence_name>;