Oracle Sequences

前端之家收集整理的这篇文章主要介绍了Oracle Sequences前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Sequence: Define a Sequence to generate sequential numbers automatically

 

  example:可以在 update、select、insert语句中使用

  

sql> ed
Wrote file afiedt.buf

  1  create sequence test_seq
  2  increment by 10
  3  start with 100
  4  maxvalue 200
  5  minvalue 110
  6  cycle
  7* nocache
sql> /
create sequence test_seq
*
ERROR at line 1:
ORA-04006: START WITH cannot be less than MINVALUE

sql> ed
Wrote file afiedt.buf
  1  create sequence test_seq
  2  increment by 10
  3  start with 120
  4  maxvalue 200
  5  minvalue 110
  6  cycle
  7* nocache
sql> /
Sequence created.
sql> select test_seq.nextval from dual;
   NEXTVAL
----------
       120

sql> select test_seq.currval from dual

   CURRVAL
----------
       120

sql> 

猜你在找的Oracle相关文章