在Oracle中使用序列创建唯一流水号

来源:互联网 发布:汪涵人设崩 知乎 编辑:程序博客网 时间:2024/04/25 09:56

先创建序列;

create sequence SEQ_DJLSH
minvalue 1
maxvalue 9999999999
start with 1920
increment by 1
cache 20;

使用序列得到唯一流水号

create or replace procedure RF_G002_GETDJLSH(p_djlsh out t_djls.flowid%type) is
  /*
  得到单据流水号
  ljg
  2008-03-03
  */
  v_flowid number(12, 0);
begin
  select seq_djlsh.nextval into v_flowid from dual;
  p_djlsh := v_flowid;
exception
  when others then
    p_djlsh := 0;
end;

原创粉丝点击