Icon SENSITIVE

Returns whether or not a result set cursor is sensitive to changes by other sessions.

Syntax
SENSITIVE(<CursorName>)

<CursorName> =

Previously-opened result set cursor

Returns
BOOLEAN

Usage
The SENSITIVE function returns whether or not a result set cursor is sensitive to changes by other sessions. If the result set cursor has not been opened yet by using the OPEN statement, then calling this function will result in an error. Please see the Result Set Cursor Sensitivity topic for more information.

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

-- An error is raised if the result cursor generated
-- is not sensitive to changes by other sessions

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

   PREPARE Stmt FROM 'SELECT * FROM Customer ORDER BY CustomerID';

   OPEN CustCursor;

   IF (NOT SENSITIVE(CustCursor)) THEN
      CLOSE CustCursor;
      RAISE ERROR CODE 12000 MESSAGE 'Result set cursor is insensitive';
   END IF;

   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