Tuesday, September 11, 2007

Cursor closes at COMMIT unless you use the WITH HOLD option on cursor.

Cursor closes at COMMIT unless you use the WITH HOLD option on cursor.

Example
OPEN UPDATE_CURSOR WITH HOLD;


-- Declare cursor
FOR vl AS
c1 CURSOR with hold FOR
SELECT customer_id as id,full_name from customer where full_name like 'test%'
DO
update customer set status ='A' where customer_id = id;
COMMIT; <======= Can commit inside Loop if you choose WITH HOLD

END FOR;
COMMIT;




ref ,
ibm

No comments: