Hi,

we are using db29.7 fp 4.
I am in db2 for quite sometime but have encountered this issue for the first time.

In a stored procedure, there is a session table. (Declare global temporary table ... ON COMMIT DELETE ROWS
NOT LOGGED
ON ROLLBACK DELETE ROWS
WITH REPLACE)
when I delete from this session table using the "where" clause(Not deleting complete data) and if there are no eligible rows to delete, then the procedure returns wrong data.

But when I enclosed the delete statement within if condition checking if there are any rows to delete then delete else do nothing, the procedure works fine.

On searching on net, I found somewhere that the delete from session table deletes all the rows. But that isn't the case here because 2 rows are getting returned by the proc in my case.

Can someone help me with the understanding of delete from the session table?

Thanks.