求此段代码Oracle的写法
CREATE TRIGGER trg_insPayroll
for INSERT ON hrshicb
begin
insert into Hrsscbd(Cbdwno,Cbdbak,Cbdare,Cbdtfe)
select icbwno,1, '1 ',1 from inserted
insert into EmployeeCModel(Employeeid,Appid)
select icbwno,2 from inserted
end
目的:当对表hrshicb插入数据时,同时对Hrsscbd与EmployeeCModel表插入记录,所需的icbwno字段需取hrshicb表中的icbwno字段
------解决方案--------------------CREATE OR REPLACE TRIGGER trg_insPayroll
AFTER INSERT
ON hrshicb
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
insert into Hrsscbd(Cbdwno,Cbdbak,Cbdare,Cbdtfe)
select icbwno,1, '1 ',1 from new;
insert into EmployeeCModel(Employeeid,Appid)
select icbwno,2 from new;
END trg_insPayroll;
------解决方案----------------------
CREATE OR REPLACE TRIGGER trg_insPayroll
AFTER INSERT
ON hrshicb
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
insert into Hrsscbd(Cbdwno,Cbdbak,Cbdare,Cbdtfe)
values(:new.icbwno,1, '1 ',1 );
insert into EmployeeCModel(Employeeid,Appid)
values(:new.icbwno,2);
END trg_insPayroll;