把for each row去处掉。行级触发器不允许读触发的表,需要改为表级的触发器。如果你的逻辑是想对新插入的行自动补bj的值,可以改为
create or replace trigger zsf_py_cj_bj
before insert on py_cj
for each row
declare
stmt varchar2(200);
begin
select bh into :NEW.bj from student t1 where t.xh = t1.xh ;
end zsf_py_cj_bj;
create or replace trigger zsf_py_cj_bj
before insert on py_cj
for each row
declare
stmt varchar2(200);
begin
select bh into :NEW.bj from student t1 where t.xh = t1.xh ;
end zsf_py_cj_bj;
谢谢
但是如果是before的话,好像不会对当前插入的纪录补齐bj 阿