The technique of creating temporary tables to extract data from permanent tables is often used. Because the existent of the local temp table is session related, you need to create these temporary tables in your current session. The User-Defined Temp Table window allows you to create temp tables to use so that you may optimize and analyze SQL statements that use temporary tables. Besides temporary table that you create using the User-Defined Temp Table window, temporary table may also be created during the scanning by the SQL Scanner and during the optimization process by the SQL Optimizer.
Note: Temporary Tables created in the User-Defined Temp Table module are not available in the SQL Worksheet module since a new database session is used to execute commands in the SQL Worksheet.
Temporary tables only exist in your current session. In order to optimize a SQL statement that uses temporary tables, these tables need to be created in this session before you optimize. The User-Defined Temp Table window allows the creation of temporary tables to be use throughout modules that use the original sessions that is created as you logon.
Temporary tables created in the User-Defined Temp Table module are used in the SQL Optimizer and SQL Scanner and can be viewed in the Database Explorer. An icon displays in the status bar of the main window to indicate at least one temporary table was created under the current session.
Temporary tables are dropped when you
Exit from the program
Reconnect with the same or a different user logon
Drop it using the User-Defined Temp Table module
To create temporary tables
Enter the SQL for creating the temporary table on the Creation tab. Multiple commands can be entered.
After the temporary table is created you will notice an icon on the bottom right of the main window status. This icon disappears when all user-defined temporary tables are dropped.
The User-Defined Temp Table module only supports SQL statements that create or modify temporary tables; these are:
Note: Temporary tables created within the User-Defined Temp Table window can be used in all modules but the SQL Worksheet. The SQL Worksheet module creates a separate session so temporary tables created in the User-Defined Temp Table cannot be used in the SQL Worksheet and vice versa.
In the User-Defined Temp Table window, if the commands for creating the temporary table contain parameters, you are prompted to enter the data types and values on the Parameters window after you click Execute.