Chat now with support
Chat with Support

SQL Optimizer for DB2 LUW 4.4.1 - Installation Guide

Embedded and Dynamic SQL Statements

The SQL Scanner can extract a SQL statement that is an embedded SQL statement or is a dynamic SQL statement on a single command line. A dynamic SQL statement which is constructed from several command lines is not created until the user and program make decisions on what to include at run time. The SQL Scanner cannot extract this type of SQL statement.

Embedded SQL Statements

Embedded SQL statements refer to SQL statements that are placed within the source programs and are constructed at compilation time. Embedded SQL statements are complete statements found in the source code in one continuous string.

Dynamic SQL Statements on a Single Command Line

Database Objects and files may contain a SQL statement that is on one command line, is placed within quotes, and may be concatenated with other parts of the statement and/or local program variables.

For example:

SQL1:= "SELECT emp_id , " + variableA + " FROM employee";

Dynamic SQL Statements on several command lines

Dynamic SQL statements may also be constructed from parts of the SQL statement which are on several command lines. The user or program must decide at run time how the entire SQL statement will be constructed.

Note: If your SQL statements are dynamic SQL statement generated by the application at run time from several command lines, you can use the DB2 Event Monitor to capture the SQL statements. Then, the SQL Scanner can be used to analyze the captured SQL statements.

 

Related Documents