以下是触发器内容:
我想在表PPLME_SYS中某一列被更新是更新与其相关的另一列,但老是报错死循环
CREATE OR REPLACE TRIGGER "INFODBA"."TEST" BEFORE
UPDATE OF "PPLM_STRING01" ON "PPLME_SYS" FOR EACH ROW DECLARE pragma autonomous_transaction;
tempPUID varchar2(32);
CURSOR Mycur is
select PPLM_STRING01 from PPLME_SYS where PUID=:new.PPLM_STRING01;
CursorRecord Mycur%ROWTYPE;
begin
open Mycur;
FETCH Mycur into CursorRecord;
if Mycur%NOTFOUND
then
if :new.PPLM_STRING01 is not null
then
update PPLME_SYS set PPLM_STRING03='aa' where PUID=:new.PPLM_STRING01;
update PPLME_SYS set PPLM_STRING01=:new.PUID where PUID=:new.PPLM_STRING01;
end if;
else
update PPLME_SYS set PPLM_STRING03='aa' where PUID=:new.PPLM_STRING01;
select PPLM_STRING01 into tempPUID from PPLME_SYS where PUID=:new.PPLM_STRING01;
if tempPUID is null then
update PPLME_SYS set PPLM_STRING01=:new.PUID where PUID=:new.PPLM_STRING01;
end if;
end if;
commit;
end;多谢!
我想在表PPLME_SYS中某一列被更新是更新与其相关的另一列,但老是报错死循环
CREATE OR REPLACE TRIGGER "INFODBA"."TEST" BEFORE
UPDATE OF "PPLM_STRING01" ON "PPLME_SYS" FOR EACH ROW DECLARE pragma autonomous_transaction;
tempPUID varchar2(32);
CURSOR Mycur is
select PPLM_STRING01 from PPLME_SYS where PUID=:new.PPLM_STRING01;
CursorRecord Mycur%ROWTYPE;
begin
open Mycur;
FETCH Mycur into CursorRecord;
if Mycur%NOTFOUND
then
if :new.PPLM_STRING01 is not null
then
update PPLME_SYS set PPLM_STRING03='aa' where PUID=:new.PPLM_STRING01;
update PPLME_SYS set PPLM_STRING01=:new.PUID where PUID=:new.PPLM_STRING01;
end if;
else
update PPLME_SYS set PPLM_STRING03='aa' where PUID=:new.PPLM_STRING01;
select PPLM_STRING01 into tempPUID from PPLME_SYS where PUID=:new.PPLM_STRING01;
if tempPUID is null then
update PPLME_SYS set PPLM_STRING01=:new.PUID where PUID=:new.PPLM_STRING01;
end if;
end if;
commit;
end;多谢!
解决方案 »
- 急求!!oracle9i dblink ora-12154:tns无法处理服务器名 问题
- 关于左外连接查询问题
- 关于ORACLE建表的特殊字段
- 请问要什么帐户密码身份才能设置自动提交
- ORA-02291: 违反完整约束条件 - 未找到父项关键字 什么原因
- 怎样配制Oracle的Jdbc驱动,让JSP访问Oracle数据库?
- 升级了机器,在win2000server上装oralce8.1.7,出现问题
- 问一根据范围不同取不同值的查询sql!
- 请问ORACLE里面的查询包含子字符串位置的函数是什么?就象SQL SERVER里的CHARINDEX()
- exp出错,请大家帮忙看看
- 触发器的导入
- oracle 建表 报错
loop
FETCH Mycur into CursorRecord;
exit when Mycur%Notfound
if :new.PPLM_STRING01 is not null
then
update PPLME_SYS set PPLM_STRING03='aa' where PUID=:new.PPLM_STRING01;
update PPLME_SYS set PPLM_STRING01=:new.PUID where PUID=:new.PPLM_STRING01;
end if;
else
update PPLME_SYS set PPLM_STRING03='aa' where PUID=:new.PPLM_STRING01;
select PPLM_STRING01 into tempPUID from PPLME_SYS where PUID=:new.PPLM_STRING01;
if tempPUID is null then
update PPLME_SYS set PPLM_STRING01=:new.PUID where PUID=:new.PPLM_STRING01;
end loop;触发器出现异常将自动回滚