× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks, Chuck, that was it! I'm used to SQL Server's top-down method it
didn't occur to me to group all the declarations.

Begin
declare workfromdate int;
declare workthrudate int;
declare c1 cursor with return for
select dmekcd as partnumber, dmehcd as stockloc,
dmcdcd as transcode, sum(dmgzfq) as quantity,
idate(dmatdt,'*CYMD')
from vngdbdta/dbdmrep /* Inventory transactions */
where dmazcd = 'WV' /* Water Valley location */
and dmatdt between workfromdate and workthrudate
and dmcdcd = ';MRCT' /* Transaction code */
and dmehcd = 'SH'
group by dmekcd, dmehcd, dmcdcd, dmatdt
having sum(dmgzfq) <> 0
order by dmatdt, dmekcd;
set workfromdate =
converttoidate(idate(fromdate,'*mdccyy'),'*CYMD');
set workthrudate =
converttoidate(idate(thrudate,'*mdccyy'),'*CYMD');
open c1;
end


Loyd Goodbar
Senior programmer/analyst
BorgWarner
TS Water Valley
662-473-5713

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Tuesday, December 11, 2007 11:34
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Calculations in a stored procedure?

DECLARE activity must be first; even the DECLARE CURSOR. The
solution is by moving the SET statements *after* the DECLARE section;
i.e. instead of /remove/ them, only /move/ the SET statements.

Regards, Chuck



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.