DB2创建sequence
1、创建sequenceCREATE sequence my_seq AS INTEGER START WITH 628 increment BY
2、获取sequence的下一个
values nextval for my_seq(my_seq是sequence名称)
3、在sql中使用sequence的下一个值
insert into table_name(id) values(nextval for my_seq)
创建SEQUENCE:
Sql代码
[*]CREATE SEQUENCE NAME_XXX_SEQ AS INT START WITH 1000 INCREMENT BY 1 MINVALUE 1
[*] NO MAXVALUE NO CYCLE NO CACHE ORDER;
查询SEQUENCE:
Sql代码
[*]SELECT NEXTVAL FOR NAME_XXX_SEQ FROM SYSIBM.SYSDUMMY1;
页:
[1]