oracle中实现mssql中的IDENTITY功能
使用sequence来实现相应的操作
创建stu表:
create table STU
(
ID INTEGER,
SNM VARCHAR2(30)
)
创建关于stu中id列的sequence:
create sequence sq_stu_id
minvalue 1
maxvalue 10000000
start with 1
increment by 1
nocache;
使用sequence向stu表中加入数据:
insert into stu values(sq_stu_id.nextval,'rpg');
查询结果:
select * from stu;
ID SNM
--------------------------------------- ------------------------------
1 rpg