create table hehehe( zheId number primary key, nima varchar2(50) not null );create sequence seq_ciao; create sequence seq_ciaos;insert into hehehe values(seq_ciao.nextval,'从几开始'); select * from hehehe;select seq_ciaos.nextval from dual;--作弊可是无意义的。就这样的语句,就这样的效果,别笑我的命名
LZ 我找到答案了,请看 http://docs.oracle.com/cd/E11882_01/server.112/e17118/statements_6015.htm#SQLRF01314 这是11g r2的新特性 Note on Using Sequences with Deferred Segments If you attempt to insert a sequence value into a table that uses deferred segment creation, the first value that the sequence returns will be skipped.
Note on Using Sequences with Deferred Segments If you attempt to insert a sequence value into a table that uses deferred segment creation, the first value that the sequence returns will be skipped 什么乱翻译器? 应该是:在延迟段技术中使用序列应当注意如果你在尝试插入一个序列值到一个使用延迟段技术创建的表中,那么序列的第一个返回值将被跳过。
create是该序列第一个事务,1被分配
你再试试,创建2个序列一样的,一个做insert 一个做select ,我试过了是一样的
create table hehehe(
zheId number primary key,
nima varchar2(50) not null
);create sequence seq_ciao;
create sequence seq_ciaos;insert into hehehe values(seq_ciao.nextval,'从几开始');
select * from hehehe;select seq_ciaos.nextval from dual;--作弊可是无意义的。就这样的语句,就这样的效果,别笑我的命名
跟事务有毛的关系,只要你调用了nextval它就向前进1. 不会后退。
http://docs.oracle.com/cd/E11882_01/server.112/e17118/statements_6015.htm#SQLRF01314
这是11g r2的新特性
Note on Using Sequences with Deferred Segments If you attempt to insert a sequence value into a table that uses deferred segment creation, the first value that the sequence returns will be skipped.
这句话我暂时不理解。
什么乱翻译器?
应该是:在延迟段技术中使用序列应当注意如果你在尝试插入一个序列值到一个使用延迟段技术创建的表中,那么序列的第一个返回值将被跳过。