Declare Scrollable Cursor on Orders DB2 Table



A SCROLLABLE CURSOR can move in both forward and backward direction. In other words, it can fetch next as well as previous rows. A SCROLLABLE CURSOR is declared using the “SCROLL” clause in the DECLARE CURSOR.

For example, if we want to declare a SCROLLABLE CURSOR on the ORDERS table then we have to declare the cursor like below.

EXEC SQL
      DECLARE ORDER_CURR SCROLL CURSOR FOR
         SELECT ORDER_ID, ORDER_DATE FROM ORDERS
            WHERE ORDER_DATE = ‘2020-07-29’
END-SQL
Updated on: 2020-09-15T11:08:13+05:30

582 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements