当前位置: 代码迷 >> Oracle技术 >> 序列触发,该如何解决
  详细解决方案

序列触发,该如何解决

热度:65   发布时间:2016-04-24 08:35:36.0
序列触发
create sequence sep_employee_empid
increment by 1
start with 0
maxvalue 999
minvalue 0
nocache
cycle

--创建触发器
create trigger trg_employee 
before insert
on tb_employee
for each row
declare
a number:=1000;
b number:=sep_employee_empid.nextval;
begin
select 'e'||to_char(a+b) into:new.empID from dual;
end;


报了个错
ORA-01008:并非所有变量都已绑定

------解决方案--------------------
-创建触发器
create trigger trg_employee
before insert
on tb_employee
for each row
declare
a number:=1000;
b number:=sep_employee_empid.nextval;
begin
select 'e'||to_char(a+b) into b from dual;
:new.empID := b ; 
end;
  相关解决方案