Explain the difference between SENSITIVE and INSENSITIVE scrollable CURSOR with the help of an example and syntax

DB2DatabaseBig Data Analytics

The INSENSITIVE SCROLLABLE CURSOR are sort of read only cursors in which the result table cannot change once the cursor is opened. The other applications also cannot update the INSENSITIVE SCROLLABLE CURSOR once it is opened. The SENSITIVE SCROLLABLE CURSOR, unlike INSENSITIVE are sensitive to changes made in the result table. The changes made by other applications will be reflected in the result table.

We can declare SENSITIVE and INSENSITIVE SCROLLABLE CURSOR like below.

EXEC SQL
      DECLARE ORDER_CURR SENSITIVE SCROLL CURSOR FOR
         SELECT ORDER_ID, ORDER_DATE FROM ORDERS
            WHERE ORDER_DATE = ‘2020-07-29’
END-SQL
EXEC SQL
      DECLARE ORDER_CURR INSENSITIVE SCROLL CURSOR FOR
         SELECT ORDER_ID, ORDER_DATE FROM ORDERS
            WHERE ORDER_DATE = ‘2020-07-29’
END-SQL
raja
Published on 15-Sep-2020 14:39:58
Advertisements