×
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.
What is wrong with the syntax of my UDF? The compiler throws on the SET
RESULT and SET RECCOUNT lines as well as on the IF statement. Do I need
to set up a cursor?
Thanks
chris
BEGIN
DECLARE RESULT DECIMAL ( 13 , 2 ) ;
DECLARE RECCOUNT INTEGER ;
SET RESULT = 0;
SET RECCOUNT = 0;
SELECT COUNT(*) INTO RECCOUNT FROM IWPREPORTS.BOOK07R_HELPER1 WHERE
ITCLS = PARAM_ITCLS;
IF RECCOUNT = 1 THEN
SELECT YTD INTO RESULT FROM IWPREPORTS.BOOK07R_HELPER1 WHERE
ITCLS = PARAM_ITCLS;
ELSEIF RECCOUNT = 0 THEN
SELECT
SUM(AMFLIB.MTHACTVY.INSAH) INTO RESULT
FROM
AMFLIB.MTHACTVY
WHERE
AMFLIB.MTHACTVY.ITCLS = PARAM_ITCLS AND
AMFLIB.MTHACTVY.TDATE BETWEEN PARAM_STARTDATE AND PARAM_ENDDATE
AND
( ( AMFLIB . MTHACTVY . SACUR >= 10 AND AMFLIB . MTHACTVY
. TDATE < PARAM_YEARSTART ) OR
( AMFLIB . MTHACTVY . SACUR < 10 AND AMFLIB . MTHACTVY .
TDATE >= PARAM_YEARSTART ) );
-- UPDATE TEMPORARY TABLE
INSERT INTO IWPREPORTS.BOOK07R_HELPER1 (ITCLS,YTD) VALUES
(PARAM_ITCLS,RESULT);
ENF IF;
RETURN RESULT ;
END
As an Amazon Associate we earn from qualifying purchases.
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.