CREATE LOCAL TEMPORARY TABLE syntax [CR 605785]

The CREATE TABLE statement now includes the LOCAL keyword for creating temporary tables. The syntax is:

CREATE [ { GLOBAL | LOCAL } TEMPORARY ] TABLE
owner. ]table-name
… ( column-definitioncolumn-constraint ] …

In a procedure, use the CREATE LOCAL TEMPORARY TABLE statement, instead of the DECLARE LOCAL TEMPORARY TABLE statement, when you want to create a table that persists after the procedure completes. Local temporary tables created using the CREATE LOCAL TEMPORARY TABLE statement remain until they are either explicitly dropped, or until the connection closes.

Local temporary tables created in IF statements using CREATE LOCAL TEMPORARY TABLE also persist after the IF statement completes.