Subject | Re: [firebird-support] Stored Proc |
---|---|
Author | Milan Babuskov |
Post date | 2003-09-26T15:54:11Z |
skotaylor wrote:
CYCLE14 = 0;
CYCLE8 = 0;
CYCLE7 = 0;
before the loop. I guess that values are initializet to null, so when
you add any number to null, you get null.
HTH
--
Milan Babuskov
http://fbexport.sourceforge.net
> but when I run the SP via "SELECT * FROM drv_hours(:DrvID)" it returnsTry to put:
> null for all three values. I've been trying everything but the right
> thing.
>
> <pre>
> ALTER PROCEDURE DRV_HOURS( DRVID VARCHAR( 4 ) )
>
> RETURNS ( CYCLE7 DECIMAL ( 9, 2 )
> , CYCLE8 DECIMAL ( 9, 2 )
> , CYCLE14 DECIMAL ( 9, 2 ) )
>
> AS
> declare variable DDate Date;
> declare variable CTime decimal ( 9, 2);
>
> BEGIN
>
> FOR SELECT d.dumpdate, h.cycletime
> FROM disp_leg d
> join trk_hauls h on h.haulid = d.haulid
> WHERE dumped = 'Y'
> AND drvid = :DrvID
> AND NOT d.HaulID is null
> AND dumpdate between (current_date - 14) and current_date
> into :DDate, :CTime
> do
> begin
> CYCLE14 = CYCLE14 + :CTime;
> if (DDate >= (Current_Date - 8 )) then
> CYCLE8 = CYCLE8 + :CTime;
> if (DDate >= (Current_Date - 7 )) then
> CYCLE7 = CYCLE7 + :CTime;
> end
> SUSPEND;
> END
> </pre>
CYCLE14 = 0;
CYCLE8 = 0;
CYCLE7 = 0;
before the loop. I guess that values are initializet to null, so when
you add any number to null, you get null.
HTH
--
Milan Babuskov
http://fbexport.sourceforge.net