pl/sql 過程中變數未初始化導致update語句失敗

alexandre2008發表於2012-07-16
現象:
如下pl/sql 塊一直處於執行狀態
DECLARE
...
curr_distr_no varchar2(10);
BEGIN
   for rec in cur loop
    if rec.distr_no <> curr_distr_no then final_amount := 0;
    end if;
     final_amount := rec.amount + final_amount;
     update d set remain_amount = to_char(final_amount) where sn = rec.sn and distr_no = rec.distr_no;
     curr_distr_no := rec.distr_no;
  end loop;
END;
解決:
curr_distr_no varchar2(10); 改為 curr_distr_no varchar2(10) :='';

 

Link URL: http://hi.erp100.com/home.php?mod=space&uid=55664&do=blog&id=13571502

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13964895/viewspace-735556/,如需轉載,請註明出處,否則將追究法律責任。

相關文章