以LOOP的形式
CURSOR myCursor is select t.starttime,t.depachdate,t.dispachno from RPTDATA.DB_WFS_RPTWFSLIST1 twhere t.achivedate between iStartTime and iEndTimeand t.starttime is not nulland t.depachdate is not null;
if myCursor%isopen = false then open myCursor; end if; loop fetch myCursor into STARTTIME, DEPACHDATE, DISPACHNO; exit when myCursor%notfound; YWSC := (STARTTIME - DEPACHDATE) * 24; if YWSC > 4 then SUMYWSC := SUMYWSC + YWSC; YWCNT := YWCNT + 1; end if; end loop; close myCursor;
没有评论:
发表评论