Oarcle之序列

序列:是一种数据库对象,用来自动产生一组唯一的序号;

序列:是一种共享式的对象,多个用户可以共同使用序列中的序号。

  创建序列

  create sequence seq_emp_temp

  increment by 1

  start with 1

  使用序列

  通过序列名.next_val

  select seq_emp_temp.nextval from dual;

  select seq_emp_temp.currval from dual;

  insert into emp_temp(empno) values(seq_emp_temp.nextval)

  select * from emp_temp;

猜你喜欢

转载自www.cnblogs.com/weishenme/p/10776107.html