Subject RE: [ib-support] SELECT INTO local variable appears to be not working
Author Norbert Saint Georges
Hello,
The test of variable VIEWCOUNT must be in a loop for

DECLARE VARIABLE VIEWCOUNT INTEGER;
BEGIN
FOR SELECT COUNT(ACCESS_LOG_ID) FROM WEB_USERACCESSLOG WHERE
CURRENT_TIMESTAMP - LOG_DATE <= 7 AND USER_ID = :USER_ID
AND
PROJECT_ID = :PROJECT_ID INTO VIEWCOUNT
Do
Begin
IF (VIEWCOUNT = 0) THEN
BEGIN
INSERT INTO USERACCESSLOG
VALUES (-1,:USER_ID,:PROJECT_ID,CURRENT_TIMESTAMP);
END

SELECT PROJECT_NAME FROM PROJECTS
WHERE PROJECT_ID = :PROJECT_ID INTO :PROJECT_NAME;

SUSPEND;
End

END
END

Norbert