Reputation: 79
SQL DB2/400 : Does anyone knows how to check existence globale temporary table before déclare instruction in a SQL function ?
The statement "DECALRE" causes a crash of the SQL function if the temporary table is already created.
I use the instruction: "if not exists ((select count (*) from session.TEMP_IDX)) then ..." but I have the impression that it does not work ...
Upvotes: 0
Views: 179
Reputation: 23793
Use the with replace
clause of the DECLARE GLOBAL TEMPORARY TABLE
statement
That way it won't matter if the table is there or not.
Upvotes: 3