为什么会出现灾难性故障?(100)

  • 主题发起人 主题发起人 gj1024
  • 开始时间 开始时间
G

gj1024

Unregistered / Unconfirmed
GUEST, unregistred user!
我使用ORACLE9I+DELPHI7+PL/SQL7现在使用一个语句select TT.YEARTERMNAME,TT.FIRSTYEAR,TT.ENDYEAR,TT.TERMNO, TT.TIMERESTYPE,TT.MAINTABLEID, TT.OBJECTNO,TT.WEEKDAYID, rep(TT.WEEK1) WEEK1, rep(TT.WEEK2) WEEK2, rep(TT.WEEK3) WEEK3, rep(TT.WEEK4) WEEK4, rep(TT.WEEK5) WEEK5, rep(TT.WEEK6) WEEK6, rep(TT.WEEK7) WEEK7, rep(TT.WEEK8) WEEK8, rep(TT.WEEK9) WEEK9, rep(TT.WEEK10) WEEK10, rep(TT.WEEK11) WEEK11, rep(TT.WEEK12) WEEK12, rep(TT.WEEK13) WEEK13, rep(TT.WEEK14) WEEK14, rep(TT.WEEK15) WEEK15, rep(TT.WEEK16) WEEK16, rep(TT.WEEK17) WEEK17, rep(TT.WEEK18) WEEK18, rep(TT.WEEK19) WEEK19, rep(TT.WEEK20) WEEK20, rep(TT.WEEK21) WEEK21, rep(TT.WEEK22) WEEK22, rep(TT.WEEK23) WEEK23, rep(TT.WEEK24) WEEK24, rep(TT.WEEK25) WEEK25, rep(TT.WEEK26) WEEK26, rep(TT.WEEK27) WEEK27, rep(TT.WEEK28) WEEK28, rep(TT.WEEK29) WEEK29, rep(TT.WEEK30) WEEK30 from pk_timeres_teacher TT,其中的rep()是一个SQL函数,内容为create or replace function rep(STR in VARCHAR2) return varchar2 is Result varchar2(50) ; i integer;begin Result :=''; for i in 1..12 loop if (substr(str,i,1)<>'0') then Result:=Result||'1'; else Result:=Result||'0'; end if; end loop; return(Result);end rep;奇怪的是这个语句在PL/SQL下能正常运行,而在DEPHI7里就出现"灾难性故障",请高手指点一下?
 
function rep(STR in VARCHAR2) 这个应该正常,将SQL调试一下,如一个字段一个字段来试就知道了。
 
你传进去的str是否有空值或'',你在rep函数中是否要进行判断处理?
 
后退
顶部