create table r_modify(
oper_type varchar2(20) not null,
oper_time date not null,
id int not null,
readername varchar2(10) not null,
rsex varchar2(2),
runit varchar2(20),
bookcount number(10),
r_modify_id number(10)
);create sequence r_modify_id minvalue 1000 maxvalue 9999 start with 1000 increment by 1;create trigger trg_readerinfo_alt
after insert or update or delete
on readerinfo
for each row
begin
if inserting then
insert into r_modify(
oper_type,
oper_time,
id,readername,rsex,runit,bookcount,r_modify_id
) values (
'添加的数据',sysdate,:new.readerid,
:new.readername,:new.sex,:new.unit,:new.bookcount,r_modify_id.nextval
);
else if
deleting then
insert into r_modify(
oper_type,oper_time,id,
readername,rsex,runit,bookcount,r_modify_id
) values(
'删除的数据',sysdate,:old.readerid,:old.readername,
:old.sex,:old.unit,:old.bookcount,r_modify_id.nextval
);
else
insert into r_modify(
oper_type,oper_time,id,
readername,rsex,runit,bookcount,r_modify_id
) values(
'修改的数据',sysdate,:old.readerid,:old.readername,
:old.sex,:old.unit,:old.bookcount,r_modify_id.nextval
);
end if;
end;insert into readerinfo values(9716,'TEST','男','TEST',1);执行下面这条语句就报错了
oper_type varchar2(20) not null,
oper_time date not null,
id int not null,
readername varchar2(10) not null,
rsex varchar2(2),
runit varchar2(20),
bookcount number(10),
r_modify_id number(10)
);create sequence r_modify_id minvalue 1000 maxvalue 9999 start with 1000 increment by 1;create trigger trg_readerinfo_alt
after insert or update or delete
on readerinfo
for each row
begin
if inserting then
insert into r_modify(
oper_type,
oper_time,
id,readername,rsex,runit,bookcount,r_modify_id
) values (
'添加的数据',sysdate,:new.readerid,
:new.readername,:new.sex,:new.unit,:new.bookcount,r_modify_id.nextval
);
else if
deleting then
insert into r_modify(
oper_type,oper_time,id,
readername,rsex,runit,bookcount,r_modify_id
) values(
'删除的数据',sysdate,:old.readerid,:old.readername,
:old.sex,:old.unit,:old.bookcount,r_modify_id.nextval
);
else
insert into r_modify(
oper_type,oper_time,id,
readername,rsex,runit,bookcount,r_modify_id
) values(
'修改的数据',sysdate,:old.readerid,:old.readername,
:old.sex,:old.unit,:old.bookcount,r_modify_id.nextval
);
end if;
end;insert into readerinfo values(9716,'TEST','男','TEST',1);执行下面这条语句就报错了
IF UPDATING THEN
DBMS_OUTPUT.PUT_LINE(‘已更新 ORDER_MASTER 中的数据');
ELSIF DELETING THEN
DBMS_OUTPUT.PUT_LINE(‘已删除 ORDER_MASTER 中的数据');
ELSIF INSERTING THEN
DBMS_OUTPUT.PUT_LINE(‘已在 ORDER_MASTER 中插入数据');
END IF;