Chat now with support
Chat with Support

SQL Optimizer for DB2 LUW 4.3.1 - User Guide

SQL Optimizer for IBM® DB2® LUW
About SQL Optimizer for IBM DB2 LUW 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

Find a SQL Using a Text String

The Find SQL function is available in the SQL Optimizer and Scanner SQL Viewer window. It searches through SQL statements until it finds the first occurrence of the text string you specify. In SQL Optimizer, Find SQL searches the SQL syntax currently displayed in the SQL Text pane. In SQL Scanner, the function searches across all SQL statements displayed on the SQL tabs.

To find specific text within the SQL statements

  1. Select SQL | Find SQL.

  2. Enter the text string to be found and click Find.

  3. To continue searching for the same text, select SQL | Find Next SQL [Ctrl + F3].

 

Comments

Due to the lack of uniform standards in the presentation of comments within source code, it is almost impossible to implement each and every commenting indicator. We have therefore chosen to support the three most popular delimiters:

Comment Syntax

Comment

--

single line

//

single line

starting with /*

ending with */

block

During optimization these comments will be removed and will not be shown in the list of optimized SQL statements.

SQL Optimizerdoes not accept any other comment delimiters.

 

Variables

Variables can be embedded in the original SQL statement without pre-defining the data type and value. All variable names will be highlighted in red after the optimization process. SQL Optimizer will recognize declaration of variables either with or without a ":" (host variables) or "?" (parameter markers) sign. During optimization, run time or run result, the data type and value of the variables will require definition by using the Parameters window.

 

Parameters Window

ClosedView the Parameters Window

Data type and value of variables are entered using the Parameters window. If variables are embedded in the original SQL statement, the Parameters window will be displayed each time you launch the Run Result, Run for First Record, Run for All Records, and Batch Run functions. The values entered in the Parameters window have a direct result on the run time and run result retrieved.

The parameter values that you have previously entered can be saved by selecting the Enable SQL parameter history Options setting. If the same parameter is used in a SQL statement again, the value and the data type from the last time it was used is automatically entered for you.

To help identify the data type and value

  1. Click Browse to expand the Parameters window. The bottom pane appears displaying object and data information corresponding to the selected objects from the SQL statement. Select the object to browsed using the Objects and Columns lists. If a column is selected (asterisk * selects all columns from the selected object), the corresponding data type is shown.

  2. Click Load Data and highlight the cell with the variable value from the data grid. Then click Use Data & Data type or double-click the cell to copy the compatible data type and value to the parameter selected at the top of the window.

  3. Click Use Data type to copy a compatible data type to the parameter selected at the top of the window.

  4. After the data type and value of all the parameters have been selected, click OK.

Note: If the Parameters window appears when you do not have variables in the SQL statement, this may be caused by incorrect spelling of column or table names, pointing to the wrong schema, or the tables or columns do not exist in the database. If the tables or columns have been created since you opened SQL Optimizer, you may need to Synchronize the Data Dictionary.

 

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating