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> 

  

相关文章:

  • 2021-12-24
  • 2021-04-23
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-12-18
  • 2021-07-27
猜你喜欢
  • 2022-12-23
  • 2018-09-29
  • 2021-09-29
  • 2021-09-29
  • 2022-12-23
  • 2021-11-09
相关资源
相似解决方案