触发器:A,B两表结构相同,在插入A表记录之后,需要同时插入B表同一条记录,
我写的触发器:
create or replace trigger TRI_SYSHISTORY
after insert on case_info
for each row
declare
v_num integer;
begin
select count(id) into v_num from case_history where id=(select id from (select id from case_info order by id desc) where rownum = 1);
if v_num=0 then
insert into case_history
select * from (select * from case_info order by id desc) where rownum = 1;
end if;
end TRI_SYSHISTORY;
说明:case_info为表A,case_history为表B。请帮忙看看,谢谢
------解决方案--------------------触发器代码不能从触发器所对应的基表中读取数据