Oracle table mut…
来源:互联网 发布:蜂蜜和四叶草 知乎 编辑:程序博客网 时间:2024/06/06 07:29
create or replace trigger OP.update_lis_statue
afterinsert on op.op_charge
foreach row
begin
if :new.sum_total < 0 then
update ht.yj_tbs_jycomapplym t set t.fcancelflag = '1'
where t.fpatno in(select a.visit_no from op.op_visit a,op.op_charge b
where a.visit_id = b.visit_id and b.charge_id = :new.charge_id)
and t.fitemno in(select c.item_id from op.op_charge c
where c.charge_id = :new.charge_id);
end if;
endupdate_lis_statue;
after
for
begin
end
以上触发器是实现退费后更新某表的标志功能,虽然在pl/sql编译通过,但使用中报错如下:
ORA-04091: table OP.OP_CHARGE ismutating, trigger/function may not see it
ORA-06512: at "OP.UPDATE_LIS_STATUE", line 3
ORA-04088: error during execution of trigger'OP.UPDATE_LIS_STATUE'
ORA-06512: at "OP.UPDATE_LIS_STATUE", line 3
ORA-04088: error during execution of trigger'OP.UPDATE_LIS_STATUE'
分析如下:
改代码,解决如下:
create or replace trigger OP.update_lis_statue
afterinsert on op.op_charge
foreach row
begin
if :new.sum_total < 0 then
update ht.yj_tbs_jycomapplym t set t.fcancelflag = '1'
where t.fpatno in(select a.visit_no from op.op_visit a
where a.visit_id = :new.visit_id)
and t.fitemno = :new.item_id;
end if;
endupdate_lis_statue;
after
for
begin
end
行级操作,其实只要取当前插入行的数据作为约束条件就行了,当初是想太多了
0 0
- Oracle table mut…
- MUT
- oracle table
- oracle table
- oracle table
- oracle table
- oracle table
- oracle table
- oracle table
- oracle table
- oracle table
- oracle table
- oracle table
- Rust入门篇 &mut
- Oracle truncate table&…
- Oracle Temp Table
- Oracle Pipelined Table
- Temp Table in Oracle
- SAX解析xml
- Java解析虾米音乐的真实下载地址
- 关于Linux accpet()的错误处理
- 非主流数据库Firebird
- protel布局布线
- Oracle table mut…
- route add常用命令解析
- 阿里巴巴CTO王坚: 造中国“数据之都”, 人才不会被地域限制
- eclipse常用快捷键
- MYSQL语句
- 如何自己编写一个交通仿真软件(一)火种
- js中for in循环
- 一分钟搞懂SMTP/POP/IMAP邮件服务
- Criteria和DetachedCriteria