相关代码如下:
1. 创建sequence:
复制代码 代码如下:
create sequence sequ_data_datainfo increment by 1 start with 1 nocycle nocache noorder;
2. 创建触发器:
复制代码 代码如下:
create or replace trigger trig_test
before insert on table1
for each row
declare
tmpvar number;
begin
tmpvar := 0;
select sequ_proc_associateinfo.nextval into tmpvar from dual;
:new.procid:=tmpvar;
exception
when others then
— consider logging the error and then re-raise
raise;
end;