比如表
create table test(
id char(10),
name char(50),
biaoshi char(2))写一个触发器,要实现如下功能:
当对此表执行insert 命令时 ,在biaoshi字符段里做‘a’标识
当对此表执行update 命令时 ,在biaoshi字符段里做‘b’标识
当对此表执行delete 命令时 ,在biaoshi字符段里做‘c’标识在oracle下的触发器。谢谢各位
create table test(
id char(10),
name char(50),
biaoshi char(2))写一个触发器,要实现如下功能:
当对此表执行insert 命令时 ,在biaoshi字符段里做‘a’标识
当对此表执行update 命令时 ,在biaoshi字符段里做‘b’标识
当对此表执行delete 命令时 ,在biaoshi字符段里做‘c’标识在oracle下的触发器。谢谢各位
on test
for each row
begin
if inserting then :new.biaoshi := 'a’; elsif updating then :new.biaosh := 'b'; elsif deleting then :new.biaoshi := 'c'; else
:new.biaoshi :='d'end;
删除那一行就没有了
before insert or update or delete on test
for each row
begin
if inserting then
:new.biaoshi:='a';
elsif updating then
:new.biaoshi:='b';
elsif deleting then
:new.biaoshi:='c';
end if;
end;
删除的时候修改biaoshi也没什么用阿,修改后数据又被删了
动作好快,高手
这个在test表对应的触发器上加吗?老是提示我没有new 或者clob类型啊。请指教。谢谢各位
on test
for each row
begin
if inserting then :new.biaoshi := 'a’; elsif updating then :new.biaosh := 'b'; else
:new.biaoshi :='c';
end if;end;
FOR DELETE AS
IF EXISTS (SELECT * FROM deleted WHERE deliverflag != c)
BEGIN
DECLARE @a int
select @a = id from deleted
ROLLBACK
update test set biaoshi= 3 where id = @a
END