设万维读者为首页 万维读者网 -- 全球华人的精神家园 广告服务 联系我们 关于万维
 
首  页 新  闻 视  频 博  客 论  坛 分类广告 购  物
搜索>> 发表日志 控制面板 个人相册 给我留言
帮助 退出
江南风的博客  
江南风的博客  
https://blog.creaders.net/u/3799/ > 复制 > 收藏本页
我的名片
江南风
注册日期: 2010-05-12
访问总量: 4,399 次
点击查看我的个人资料
Calendar
我的公告栏
最新发布
· ORA-06553: PLS-382: expression
· Trigger: the mutating table er
友好链接
分类目录
【报税点滴】
【Database Tips】
· ORA-06553: PLS-382: expression
· Trigger: the mutating table er
存档目录
05/01/2010 - 05/31/2010
发表评论
作者:
用户名: 密码: 您还不是博客/论坛用户?现在就注册!
     
评论:
Trigger: the mutating table error ORA-04091
   I got "the mutating table error ORA-04091" when I tested one of my triggers. This is because I queried the table that fires the trigger. Here's the example, which involves 3 tables, table1 (columns: report_id, process_id,...), table2 (columns: process_id, organisation, ...), and table3 (columns: organisation, bu, ...).

create or replace trigger ci_updated_trig

  AFTER UPDATE  OF UPDATE_DTTM
  ON TABLE1
  FOR EACH ROW
DECLARE
  -- local variables here
  v_exist  NUMBER;
  v_is_wanted_ci NUMBER;
BEGIN
  -- check if this is wanted record
  SELECT COUNT(*) INTO v_is_wanted_ci
    FROM table1 t1, table2 t2, table3 t3
   WHERE t1.report_id = :new.report_id AND t1.process_id = t2.process_id AND
         t2.organisation = t3.organisation AND t3.bu='ES';

   ...... ......        
END ; If should be corrected into the following: create or replace trigger ci_updated_trig
  AFTER UPDATE  OF UPDATE_DTTM
  ON TABLE1
  FOR EACH ROW
DECLARE
  -- local variables here
  v_exist  NUMBER;
  v_is_wanted_ci NUMBER;
BEGIN
  -- check if this is wanted record
  SELECT COUNT(*) INTO v_is_wanted_ci
    FROM table2 t2, table3 t3
   WHERE t2.process_id = :new.process_id AND
         t2.organisation = t3.organisation AND t3.bu='ES';

   ...... ......        
END ;
 
关于本站 | 广告服务 | 联系我们 | 招聘信息 | 网站导航 | 隐私保护
Copyright (C) 1998-2024. CyberMedia Network /Creaders.NET. All Rights Reserved.