码迷,mamicode.com
首页 > 数据库 > 详细

Oracle Sequences

时间:2019-09-11 11:44:33      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:div   efi   amp   ica   number   less   tar   bash   line   

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 Sequences

标签:div   efi   amp   ica   number   less   tar   bash   line   

原文地址:https://www.cnblogs.com/jycjy/p/11505046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!