Icon EOF

Returns whether or not a result set cursor is at the end of the result set.

Syntax
EOF(<CursorName>)

<CursorName> =

Previously-opened result set cursor

Returns
BOOLEAN

Usage
The EOF function returns whether or not a result set cursor is at the end of the result set. The EOF function only returns True once an attempt is made to navigate past the last row via the FETCH statement, or if the result set is empty and contains no rows.

When a result set cursor is first opened via the OPEN statement, the cursor is always positioned so that the EOF function will return False unless the result set is empty, in which case both the EOF and the BOF functions will return True.

Examples
-- This procedure uses an IF statement
-- to conditionally test if the State column
-- is equal to 'FL', and if so, to change it
-- to 'NY'

-- The whole update process is wrapped inside
-- of a transaction start..commit/rollback block

CREATE PROCEDURE UpdateState()
BEGIN
   DECLARE CustCursor CURSOR WITH RETURN FOR Stmt;
   DECLARE State CHAR(2) DEFAULT '';

   PREPARE Stmt FROM 'SELECT * FROM Customer';

   OPEN CustCursor;

   START TRANSACTION ON TABLES 'Customer';
   BEGIN

      FETCH FIRST FROM CustCursor ('State') INTO State;

      WHILE NOT EOF(CustCursor) DO
         IF (State='FL') THEN
            UPDATE CustCursor SET 'State'='NY';
         END IF;
         FETCH NEXT FROM CustCursor ('State') INTO State;
      END WHILE;

      COMMIT;

   EXCEPTION
      ROLLBACK;
   END;
END

SQL 2003 Standard Deviations
This function deviates from the SQL 2003 standard in the following ways:

DeviationDetails
ExtensionThis function is an ElevateDB extension.
Image