下面的触发器是不是应该用游标作,我对SqlServer不熟,怎么也写不对
CREATE OR REPLACE TRIGGER "INSERT_USER" AFTER INSERT
ON "T_ROLE_USER"
FOR EACH ROW begin
for slc in (select funid,objectid from t_role_fun_object where roleid=:new.rid) loop
insert into t_user_fun_object(userid,funid,objectid,rid) values(:new.userid,slc.funid,slc.objectid,:new.rid);
end loop;
end;
CREATE OR REPLACE TRIGGER "INSERT_USER" AFTER INSERT
ON "T_ROLE_USER"
FOR EACH ROW begin
for slc in (select funid,objectid from t_role_fun_object where roleid=:new.rid) loop
insert into t_user_fun_object(userid,funid,objectid,rid) values(:new.userid,slc.funid,slc.objectid,:new.rid);
end loop;
end;
ON "T_ROLE_USER"
FOR EACH ROW
begin
insert into t_user_fun_object(userid,funid,objectid,rid)
select :new.userid,funid,objectid,:new.rid
from t_role_fun_object where roleid=:new.rid;
end;
/