*創(chuàng)建表A*/
create table A_ybl (
y INTEGER not null,-
b VARCHAR(30) not null,
l VARCHAR(20) not null
);
/*創(chuàng)建表A的備份表*/
create table A_ybl2 (
y INTEGER not null,
b VARCHAR(30) not null,
l VARCHAR(20) not null
);
create or replace trigger test
after insert or update or delete on A_ybl for each row
declare
error_exception exception,
errno integer,
errmsg char(20),
dummy integer,
found boolean;
begin
if inserting then
insert into A_ybl2 values(:NEW.y,:NEW.B,:NEW.l);
elsif updating then
update A_ybl2 set y=:NEW.y,
b=:NEW.b,
l=:NEW.l
where id:=:OLD.y;
elsif deleting then
delete from A_ybl2 where y=:old.id;
end if;
exception
when error_exception then
raise_application_error(errno,errmsg);
end;
本文出自:億恩科技【www.1tcdy.com】
服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質保障!--億恩科技[ENKJ.COM]
|