I'm trying to delete a bunch of records based on the results from a cursor. It's not throwing an error, but no delete is happening.
This works:-
This doesn't:-
In the "Explain SQL" option in the iSeries Navigator it says "SQL5065 Access plan not found." when it tries to do the delete, but no exception is thrown. priceDetailsPrimaryKey is being set to the correct value as I've checked by setting an out parameter to its value. I've Googled to no avail. Anyone got any ideas?
This works:-
Code:
OPEN priceDetailsCursor; FETCH priceDetailsCursor INTO priceDetailsPrimaryKey; --WHILE (endCursor = 0) DO DELETE FROM MMNBDLIB.PRCTAX WHERE FKPRCDET = priceDetailsPrimaryKey; -- SET endCursor = -1; --END WHILE; CLOSE priceDetailsCursor;
Code:
OPEN priceDetailsCursor; FETCH priceDetailsCursor INTO priceDetailsPrimaryKey; WHILE (endCursor = 0) DO DELETE FROM MMNBDLIB.PRCTAX WHERE FKPRCDET = priceDetailsPrimaryKey; SET endCursor = -1; END WHILE; CLOSE priceDetailsCursor;

Comment