Subject Question on SP
Author R. Tulloch
Hi:

When I prepare this in IBConsole I get SQL Error 104 Invalid
Command.

When I comment our the two sections (same and similar):

IF (RATE5B < :REQUIREDMIN)
THEN
BEGIN
RATEBB = RATE5B;
RATE5B = 0;
RATE3B = 0;
END

It prepares Ok. I can't see anything wrong with this and it is not
unlike
many other that work fine.

Any insight appreciated. Thanks.

Best regards


SET TERM ## ;
CREATE PROCEDURE "GENERATEUSPSQUALDATA"
AS
DECLARE VARIABLE ZIP VARCHAR(5);
DECLARE VARIABLE RATE5B INTEGER;
DECLARE VARIABLE RATE3B INTEGER;
DECLARE VARIABLE RATESB INTEGER;
DECLARE VARIABLE REQUIREDMIN INTEGER;
BEGIN
REQUIREDMIN = 200;
DELETE FROM USPSQUALREPORT;
DELETE FROM STRINGWORKTABLE;
INSERT INTO STRINGWORKTABLE(STRING1)
SELECT DISTINCT SUBSTR(ZIP,1,5) FROM NEWSLET;
INSERT INTO STRINGWORKTABLE(STRING1)
SELECT DISTINCT SUBSTR(ZIP,1,3) FROM NEWSLET;
FOR SELECT SW.STRING1 FROM STRINGWORKTABLE SW
INTO ZIP DO
BEGIN
SELECT COUNT(*) FROM NEWSLET N1
WHERE SUBSTR(N1.ZIP,1,5) = :ZIP
INTO RATE5B;
IF (RATE5B < :REQUIREDMIN)
THEN
BEGIN
RATEBB = RATE5B;
RATE5B = 0;
RATE3B = 0;
END
SELECT COUNT(*) FROM NEWSLET N2
WHERE SUBSTR(N2.ZIP,1,3) = :ZIP
INTO RATE3B;
IF (RATE3B < :REQUIREDMIN)
THEN
BEGIN
RATEBB = RATE3B;
RATE5B = 0;
RATE3B = 0;
END
INSERT INTO USPSQUALREPORT
(TRAYZIP, RATES5B, RATES3B, RATESBB)
VALUES (:ZIP, :RATE5B, :RATE3B, :RATEBB);
END
END ##
SET TERM ; ##