create trigger atrigger 
    after update of status_flg 
    on table_a 
    for each row 
    when (status_flg='1')
  update table_a set status_flg=1 where par_row_id=:new.row_id

解决方案 »

  1.   

    when 字句应该是
        when (new.status_flg='1')
      

  2.   

    可是ORACLE中,在触发器内是禁止对变化表进行UPDATE的,
    大虾,救命啊...
      

  3.   

    实现比较麻烦,先建一个Package,定义一些全局变量,
    然后在表上建立一个语句级触发器,和一个行级触发器。
    因为ORACLE中对行级触发器的限制不允许修改变化表,但是对语句级触发器没有限制。
    所以在行级触发器中将需要修改的东西存储在Package的变量中,在语句级触发器中读取,
    然后修改变化表。
      

  4.   

    噢,在ORACLE中,这种情况是被严格禁止的,还是省省力气用JOB吧
      

  5.   

    昨天我想了一下,可能要对你的表结构进行小的修改,语句如下:
    alter table yourtable add column flag number(1) default 0;
    当你将status_flg从0改为1时同时也将flag的值修为1.即
    update yourtable set status_flg=1,flag=1
    更新时使用
    update yourtable set status_flg=1 where flag=1;和
    update yourtable set flag=0;
      

  6.   

    采用helios(太阳神) 的建议:
       在语句级触发器中,update table_a set other_field ='$#' where ...,是可以的;
                                          ~~~~~~~~~~~~~~~~~~ 
    但是,update table_a set status_flg ='1' where ...就不行了。
                            ~~~~~~~~~~~~~~~~
    因为我的行级触发器when (old.status_flg ='2' and new.status_flg ='3'),大家再帮我
    想想办法吧,再20分
      

  7.   

    when (old.status_flg ='0' and new.status_flg ='1')
      

  8.   

    我也是常碰到变化表的问题,解决方法是写个procedure,然后在做完每个Insert命令后,再条用
    这个procedure,别的实在没什么好方法。