Subject Re: [ib-support] Stored Proc Question
Author Robert F. Tulloch
> At 01:54 PM 03-10-01 +0100, Artur Anjos wrote:
> >Did you read the manual? :)
> >
>
> You took the words right out of my mouth. :)

mia culpa.

Prepare this results Invalid Command. Any suggestions appreciated.

Best regards

SET TERM ## ;
CREATE PROCEDURE MEMBERDUESCHANGE (EFFECTIVEDATE DATE, EFFECTIVEYEAR
INTEGER,
OLDPAY1 INTEGER, NEWPAY1 INTEGER,
OLDPAY2 INTEGER, NEWPAY2 INTEGER,
OLDPAY3 INTEGER, NEWPAY3 INTEGER)
AS
DECLARE VARIABLE vid INTEGER;
DECLARE VARIABLE vrd INTEGER;
BEGIN
FOR SELECT m.id, p.renew_dues
FROM members m JOIN mempay2 p ON (m.id = p.id)
WHERE (m.status_mem = 'ACTIVE' OR m.status_mem = 'CANCELLED')
AND p.renew_date >= :effectivedate
AND p.yearM2 >= :effectiveyear
INTO vid, vrd
DO BEGIN
IF (:vrd = :oldpay1) THEN BEGIN
UPDATE mempay2 SET renew_dues = :newpay1 WHERE id = :vid
AND yearm2 >= :effectiveyear;
END
ELSE IF (:vrd = :oldpay2) THEN BEGIN
UPDATE mempay2 SET renew_dues = :newpay2 WHERE id = :vid
AND yearm2 >= :effectiveyear;
END
ELSE IF (:vrd = :oldpay3) THEN BEGIN
UPDATE mempay2 SET renew_dues = :newpay3 WHERE id = :vid
AND yearm2 >= :effectiveyear;
END
END

END ##
SET TERM ; ##