You can refine the list of indexes to be included by providing an advanced SQL statement with a customized WHERE clause. Any valid WHERE clause that selects indexes to be included can be specified.
About this task
Advanced SQL works with the selection criteria that you specify in the Database Like, Index Like, and Creator Like fields on the Enter Indexes Like to Display window. The results of selection criteria are intersected with the results of the advanced SQL statement to select the indexes.
Selecting indexes from a list requires setting the Wildcard field to N on the Enter Indexes Like to Display window. When Wildcard is set to N, the advanced SQL is used to build the list of indexes from which to select. After you choose the indexes, the advanced SQL is discarded and not saved in the object profile.
Procedure
On the Enter Indexes Like to Display window, enter a database, index, or creator name or mask in the appropriate fields and enter N in the Wildcard field.
Note: The Creator Like and Index Like fields allow up to 128 bytes. To scroll these fields, place the cursor in the field and use the PF11 key to scroll right and the PF10 key to scroll left.
Enter Y in the Advanced SQL field and Y in the Update SQL field, as shown in the following figure.
Press Enter.
The Object Selection Advanced SQL panel is displayed, as shown in following figure:
Enter your SQL statement in the SQL input area.
You can enter any SQL statement that meets these requirements:
It must be a SELECT statement that specifies the following columns:
The first column is required and must represent a database name.
The second column is required and must represent an index name.
The third column is optional, but if present must represent a partition number.
The FROM clause must be specified after the SELECT statement.
Use any WHERE clause criteria that identifies the objects to be included in the object profile.
You can enter comments by inserting two consecutive hyphens, followed by the comment. Any characters that follow two consecutive hyphens and are before the end of a line are ignored.
You can optionally enter the T line command to look up table names and their columns on the subsystem. This command invokes the Table Selection panel, which you can use to generate a list of tables on this subsystem and find column names associated with the tables.
The following panel shows a sample valid advanced SQL statement:
To verify that the results of the SQL select statement are as expected, enter EXECUTE in the Option field and press Enter.
The SQL statement is run and the results of the SELECT are listed on the Advanced SQL Test Facility panel, as shown in the following figure:
This panel shows the results of the SQL SELECT statement execution. The data on the panel is read only.
Note: The EXECUTE command runs the SQL statement without consideration for the Database Like, Index Like, and Creator Like criteria that you specified on the Enter Indexes Like to Display window.
When you are satisfied with the results of the SELECT statement, on the Advanced SQL Test Facility panel, press PF3 twice.
Note: Because the Wildcard field was set to N on the Enter Indexes Like to Display window, the SQL statement is not saved when you exit the Object Selection Advanced SQL panel.
The Include Index Selection panel is displayed. This panel shows the results of the intersection of the SQL SELECT statement and the Database Like, Index Like, and Creator Like criteria that you specified on the Enter Indexes Like to Display window. The following figure shows the results:
On the Include Index Selection panel, select the indexes that you want to include in the object profile.
What to do next
When you are finished adding indexes, press PF3 until the Update Object Profile Display is displayed. For more information, see Updating an object profile.