Positioned Delete in a Stored Procedure

Positioned Delete in a Stored Procedure

 

  

Hi..

I am trying to do a positioned update within an SQL stored procedure as below( DB2 V7.2 on AIX)

1. Declare C1 cursor for update of columns fetch first 1000 rows only on commit preserve rows
2. -- Outer Loop till no more records to update
Open C1
-- Inner Loop till 1000 records are fetched and updated
Fetch C1
Update T1 set columns where current of c1

-- End Inner Loop
commit;
Close C1;
-- End Outer Loop

I am trying to implement the above algo to ensure that the update is commited every 1000 records to release the locks.

The positioned update doesn't seem to work in a stored procedure though the SP compiles successfully.

Anyone else noticed this or am I missing something here ?


Thanks

Praveen









DB2 & UDB email list listserv db2-l LazyDBA home page