自訂 function 中直接執行下列子句會出現如圖的錯誤
delete from icmast where ttranno=:mtranno and icmast.trankind='ICTRANDETL' and icmast.trantype=:mtttype and seqno not in (select seqno from ictran where tranno=:mtranno and trantype=:mtttype);
後來才改用以下處理,先轉成字串再利用Execute Immediate 執行之
ls_delete="delete from icmast where ttranno='"+mtranno+"' and icmast.trankind='ICTRANDETL' and icmast.trantype='"+mtttype+"' and seqno not in (select seqno from ictran where tranno='"+mtranno+"' and trantype='"+mtttype+"');"
Execute Immediate :ls_delete Using sqlca;if sqlca.sqlcode<>0 then
messagebox("Notice","Delete old and surplus icmast failed.Tranno="+mtranno+" ,trantype="+mtttype+"~n~n"+sqlca.sqlerrtext)
end if