Explaining SQL

To explain the SQL you have entered in the statement entry area, enter the EXPLAIN primary command. FM/Db2 creates an EXPLAIN statement for the entered SQL, and optionally displays the Plan Table Rows panel showing the rows added by Db2® as a result of the explain.

Note: For detailed information about explaining an SQL statement, see the DB2 for z/OS SQL Reference.

To help identify the results of this explanation, you can enter a number in the Query number entry field. If you leave Query number blank, FM/Db2 generates a query number for you in the format YYYYMMDDss, where ss is a sequence number.

If you have selected the Show results option, FM/Db2 attempts to display the relevant rows that Db2® has inserted in the plan table as a result of explaining the statement. If you have entered more than one SQL statement, the statements are explained in sequence, interrupted by the display of the plan table rows. Execution continues until an error occurs, the CANCEL command is entered on a plan table display, or all the statements have been explained.

You can use the Enter, Execute and Explain SQL Statements panel to explain the following SQL statements:
  • SELECT
  • INSERT
  • UPDATE (searched form only)
  • DELETE (searched form only)
The following primary commands are available with the Enter, Execute and Explain SQL Statements panel:
  • DOWN
  • EXECUTE
  • EXPLAIN
  • SQL
  • UP

Related tasks

Related references