Icon ROWCOUNT

Returns the row count for a result set cursor.

Syntax
ROWCOUNT(<CursorName>)

<CursorName> =

Previously-opened result set cursor

Returns
INTEGER

Usage
The ROWCOUNT function returns the row count for a result set cursor. If the result set cursor has not been opened yet by using the OPEN statement, then calling this function will result in an error.

Examples
-- This procedure checks to see if the
-- specified State exists in the States lookup
-- table and inserts it if it isn't

CREATE PROCEDURE LookupState(IN State CHAR(2) COLLATE ANSI_CI)
BEGIN
   DECLARE StateCursor SENSITIVE CURSOR FOR Stmt;

   PREPARE Stmt FROM 'SELECT * FROM States WHERE State = ?';

   OPEN StateCursor USING State;

   IF (ROWCOUNT(StateCursor) = 0) THEN
      INSERT INTO StateCursor VALUES (State);
   END IF;

   CLOSE StateCursor;   

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