create sequence bookID
Start with 1
Increment by 1
Maxvalue 99999999
nocache
nocycle;
創(chuàng)建的序列從1開始然后下一個(gè)增加1盹兢,最大99999999刘急,數(shù)值不可循環(huán)使用
插入數(shù)據(jù)的時(shí)候
insert into book(bookid,bookname)
values(bookID.Nextval,'三毛流浪記');
插入bookid的值為下一個(gè)序列
查看當(dāng)前和下一個(gè)序列值
select bookid.currval from dual;
select bookid.nextval from dual;