create or replace trigger "SEL_APPLY_UPDATE3"  after update on sel_apply   FOR EACH ROWdeclare
  phaseidtemp Sel_phase_inout.Phaseid%TYPE;begin
  if (:old.status <> :new.status) and (:new.status<>1) then
  update Sel_phase_inout
     set outflag = 1
   where phaseid = :old.phaseid
     and applyid = :old.applyid;
  end if;
  if (:old.phaseid <> :new.phaseid) then
  insert into Sel_phase_inout
    (inflag,outflag,phaseid, applyid, resumeid, stationid)
  values
    (1,0,
     :new.phaseid,
     :new.applyid,
     :new.resumeid,
     :new.stationid);
  end if;end Sel_Apply_Update3;
这个是我写的一个oracle的触发器,是当sel_apply做更新操作的时候被触发.if (:old.status <> :new.status) and (:new.status<>1) then这句话是如果老的数据的status值不等于新数据的status值,并且更新的数据的status值不等于1时才执行
update Sel_phase_inout
     set outflag = 1
   where phaseid = :old.phaseid
     and applyid = :old.applyid;但是为什么更新的数据的status值等于1,为什么还走了这段逻辑,就是说(:new.status<>1)条件怎么没起作用呢?
还有一个问题,我怎么能看到某一变量的值呢?比如我想看new.status的值怎么能看到?

解决方案 »

  1.   

    PL/SQL TORD等工具都有调试功能
      

  2.   


    I send you this email following up the conversation we had about the DWH report discrepancies Marketing recently detected.Marketing produced a report on 2010-09-16 which contained 1,722 events generated from 2010-02-07 to 2010-09-16. They compared this report to the one they created on 2010-07-13 which contained 13,837 events generated from 2010-01-08 to 2010-07-13.
    The main discrepancy is on the number of events. The latest report covers a wider period of time, so it is supposed to have a bigger number of events that the older one, but instead of that it has a smaller number of events: 1,722 against 13,837.
    After analysing and comparing the information from both reports we see that the latest report has lost the period of time from 2010-01-08 to 2010-02-07. The other difference we discovered is that the number of events for several MSISDN has dramatically decreased, as you can see on the following table:  
    MSISDN Number of events on 2010-07-13 report Number of events on 2010-09-16 report difference
    34610514481 604 1 -603
    34647480305 610 0 -610
    34662472305 2038 8 -2030
    34662478906 731 43 -688
    34662682566 618 0 -618
    34663083476 613 2 -611
    34664943947 656 0 -656
    34667405067 2357 469 -1888
    34670413695 655 9 -646
    34670515186 380 1 -379
    34670544195 664 58 -606
    34680422250 1222 0 -1222
    34687110014 1409 0 -1409
    We assume Huawei recalculated the statistics taking out the events coming from the testing MSISDN. There are 3 MSISDN (highlighted in yellow) which still have a significant number of events, though.
     
    We need you to confirm this assumption and clarify the method you used to clean up the testing events. 
     
    Although, Marketing agrees on cleaning up the events coming from testing MSISDN, from now on we strongly request Huawei not to change anything on the existing statistics data-base without getting written approval from Vodafone.
     
    We need you to clarify which is the method VBP uses to update statistics on Vodafone DWH: is VBP generating and sending each time the whole data-base from the beginning to DWH or is VBP generating a partial set of data only containing the events from the last report sent to Vodafone DWH?
     
      

  3.   

    pl/sql 工具里就有调试的功能啊
      

  4.   

    在cmd进入DOS,sqlplus 执行一条update执行语句,在你的触发器中用上面有人提到的DBMS_OUTPUT.put_line可以答应当前你想要的值