立即与支持人员聊天
与支持团队交流

SQL Optimizer for DB2 LUW 5.0 - User Guide

SQL Optimizer for IBM® DB2® LUW
UsageStatistics Getting Started Options SQL Scanner SQL Optimizer SQL Formatter SQL Inspector Database Explorer SQL Repository Index Impact Analyzer Index Usage Analyzer User-Defined Temp Table Editor Functions SQL Functions SQL Information and Functions Activity Log
Tutorials About us Copyright

Create Temporary Tables

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, Index Expert, and SQL Scanner. They also can be viewed in the Database Explorer.

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

  1. Click  image\B_UserDefinedTempTable.gif.
  2. Enter the SQL for temporary table on the Creation tab. Multiple commands can be entered.
  3. Click Execute.

After the temp table is created you will notice an icon appearing on the bottom right of the main window status. This icon will disappear when all User-Defined Temp Tables are dropped.

User-Defined Temp Table only supports SQL statements that create or modify temporary . These are:

DECLARE GLOBAL TEMPORARY TABLE

DROP TABLE

INSERT

UPDATE

DELETE

Temp tables created within the User-Defined Temp Table window can be used throughout SQL Optimizer.

 

Related Topics

View SQL Scripts of Temporary Tables

After the user-defined temporary tables are created, you can view the SQL scripts used to create and populate the tables.

To review the DDL for creating temporary tables

  1. Click image\B_UserDefinedTempTable.gif.

  2. Select the Temp Table List tab.

  3. Select the desire temporary table from the Temp Table list.

 

Related Topics

Drop Temporary Tables

After the User-Defined temporary tables are created, you can delete them.

To delete temporary tables

  1. Click image\B_UserDefinedTempTable.gif.

  2. Select the Temp Table List tab.

  3. If you want to remove all temp tables, click Drop All Table.

  4. Otherwise, select the desire temp table from the Temp Table list and then click Drop Table.

 

Related Topics

Copy SQL with Temporary Tables to SQL Optimizer

When you copy a SQL statement from the Scanned SQL Viewer to the SQL Optimizer module, the Send to SQL Optimizer function automates this process for you. It copies the SQL statement, opens the SQL Optimizer window and inserts the SQL statement in the SQL Editor pane. When the SQL statement you are copying also includes a temporary table, the Send to SQL Optimizer function also copies the SQL statements for creating and populating the temporary table to the User-Defined Temp Table module.

Two items need to be considered when the SQL statements are automatically copied in the User-Defined Temp Table module. Is there SQL text already in the module? And does the temporary table already exist with the same or different data?

If SQL text is already entered into the User-Defined Temp Table module, you are prompted to save the current SQL to an ASCII file before it is overlaid with the new text. Saving the text enables you to use it again.

If a table with the same name already exists and you would like to recreate it with either a new definition or different data, then you must drop the table before executing the new SQL text. You can drop temporary table from the Temp Table List tab in the User-Defined Temp Table module.

 

Related Topics

相关文档

The document was helpful.

选择评级

I easily found the information I needed.

选择评级