System info:
DB2 for Z/OS version 10.1
I have a stored proc in which a declare global temporary table is used.
This SP would be called repeatedly from the application with the same session id. Therefore, an error "table already exists" thrown from second call onwards.
Not able to drop the table at the end of SP also as a dynamic cursor still references it.
The WITH REPLACE option for table declaration did not work in Z/OS.
Looks like error handlers are the way to go - to simply ignore the error and proceed to next statement.
Found this post related to this but couldn't get it to work.
Check that Global Temporary Table Exists or Not
Can someone provide the exact statements that can check if a session.table exists and if so, handle error and proceed to next statement.
(There is lot of syntax in google but getting it to work is tough in this case.)