时间:2021-07-01 10:21:17 帮助过:3人阅读
create or replace trigger test1_update
after update
on test1
for each row
declare
pragma autonomous_transaction;
field VARCHAR2(2000);
sum1 integer;
begin
select count(1) into sum1 from changelog where id=:new.id and table_name=‘test1‘;
if sum1<>0 then
select update_field into field from changelog where id=:new.id and table_name=‘test1‘;
end if;
if updating (‘clum1‘) then
select field||‘clum1,‘ into field from dual;
end if;
if updating (‘clum2‘) then
select field||‘clum2,‘ into field from dual;
end if;
insert into changelog values(:old.id,‘test1‘,‘0‘,‘update‘,field,sysdate,‘‘,‘‘,‘‘);
end;
输出语句是dbms_output.put_line(
‘name字段被修改‘
);
方便查看变量的值对不对。
oracle触发器
标签:比较 clu updating string update sda new name str