ORCALE 自动编号

ORCALE 自动编号

TB_OA_DUANXIN  表中的     OADX_ID  字段为自动增长
首先创个sequence :
  create sequence SEQ_TB_OA_DUANXIN
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
 
再创建个触发器:   
create or replace trigger TR_TB_OA_DUANXIN_ID_INC
  before insert on TB_OA_DUANXIN
  for each row
declare
  -- local variables here
tmp NUMBER;
begin
  select SEQ_TB_OA_DUANXIN.nextval into tmp from dual;
  :new.OADX_ID := to_char(tmp);
end TR_TB_OA_DUANXIN_ID_INC;

你可能感兴趣的:(ORCALE 自动编号)