表A 列 a_id a_name a_date
表B 列 b_id b_team b_empt b_times通过中间软件每次向A中插入N条数据 (pl/sql dev的文本导入器导入的数据)
表B有触发器 b_trigger(before型) 每次向A中插入数据的时候触发b_trigger向表B中插2N条数据. 问:怎么取得刚刚插入在A表a_name列的值.我要通过触发器插入到B表b_times列.因为每次插入A表都是N行,准确性是个问题. 期待大家的智慧.
表B 列 b_id b_team b_empt b_times通过中间软件每次向A中插入N条数据 (pl/sql dev的文本导入器导入的数据)
表B有触发器 b_trigger(before型) 每次向A中插入数据的时候触发b_trigger向表B中插2N条数据. 问:怎么取得刚刚插入在A表a_name列的值.我要通过触发器插入到B表b_times列.因为每次插入A表都是N行,准确性是个问题. 期待大家的智慧.
insert into A(a_id,a_name,a_date) values(002,'AK','2008-11-01');create or replace trigger b_trigger
before insert on B
for each row
insert into b(b_id,b_team,b_empt,b_times) values(005,'hk002','IT',/*这个地方插入刚才插入A.a_date的值*/);
end;
/--参考最后几行--创建触发器
Create or replace trigger biu_gqzydp_attachment
Before insert or update On mwt_om_fsdata
for each row
when (new.attr_id = '4DC345D9-071F-4534-B1C1-B43A93D1C988')
declare
--定义变量
user_name varchar2(64);
action varchar2(64);
begin
--记录操作类型
if inserting then
action := 'I';
elsif updating then
action := 'U';
end if;
--更新记录
insert into bhdzd_log
(obj_id, attr_id, modify_time, modify_type)
values
(:new.obj_id, :new.attr_id, sysdate, action);
end biud_gqzydp_attachment;
create or replace trigger b_trigger
before insert on tableaA --A表
for each row
insert into b(b_id,b_team,b_empt,b_times) values(005,'hk002','IT',:new.a_date);
end;