You can run a saved query, or write and run a new query. You can also run a query without opening it, using the default options.
Fields and controls for the Query Options page
To open then run a query:
1. In the SQL Queries branch of the desired connection in the DB2 Web Query Tool navigation tree, click the query that you want to run. A drop-down menu appears.
2. On the drop-down menu, click Open. The Query Options page opens.
Note: If you do not have read permission for the selected query, DB2 Web Query Tool attempts to run the query rather than open it if you have run permission.
3. In the Settings section, select your Auto-Commit preference. The Auto-Commit preference determines when your changes are committed to the database
· Select Off to prevent your changes from being automatically committed to the database. When this option is selected, commits will be made to the database manually.
Note: If you select not to have your changes automatically committed, your database will be left in an uncommitted state. This can cause problems.
· Select When Finished to have your changes committed to the database after all SQL statements have been run.
· Select After Each Statement to have your changes committed to the database after each SQL statement is run.
4. In the Name field, type the name that you want to use for the results set.
Tip: DB2 Web Query Tool provides a default results set name. You can replace this name with one that you prefer.
5. In the Max Rows field, type the maximum number of rows to return in the results set.
Tip: To return all rows to the results set, type "0" in the Max Rows field.
6. In the Timeout field, type a timeout limit.
7. From the Action drop down list, select an action to perform when a LOB is encountered. Select Omit to omit the LOB from the result set. Select Retrieve to have LOBs retrievable from the results set. When you select Retrieve, LOBs will appear as links in the results set. You can click the link to view a particular LOB and DB2 Web Query will retrieve that LOB for you from the DB2 table and show it in a viewer. Select Embed to have the LOB data embedded in the results set. LOBs in the results set will be viewable by clicking on a link. The LOB will appear in a viewer.
8. In the Limit field, type the maximum size of a LOB that will be available in the results set.
9. From the Type drop down list, select the type of LOBs to be included. Select Static and specify the file extension in the Ext./Column field to indicate that only LOBs with the specified extension will be shown. Select Column and type the name of the column, without the alias identifiers, that contains the information on the type of LOBS that will be shown in the Ext./Column field to indicate that only LOBs of the type specified in the specified column will be shown.
10. If you have SQL\PA installed on you system and your query has not been analyzed by SQL/PA, "Not Analyzed" will appear next to SQL/PA in the SQL/PA section. To analyze your query with SQL/PA, click Analyze in the SQL/PA section of the Settings section. SQL/PA analyzes one statement at a time. Therefore, if you have more than one SQL statement embedded in your query, you will see results in a cumulative format. To set your SQL/PA analysis options, click Analyze options.
Note: If you do not have SQL/PA installed, "Not Installed" will appear next to SQL/PA in the SQL/PA section.
11. Optional: Click Edit to edit the SQL query.
12. If the query contains variables, click each variable that is displayed in the Parsed Query section to define its value.
13. Type the value of the variable or select a value from the dropdown menu, if available.
· Select Use to substitute the value specified for only that instance of the variable name.
· Select All References to substitute the value specified for every instance of that variable name in the query.
· Select Ignore to treat the variable as a string.
Tip: When you click a lookup variable, a dropdown menu appears from which you can select a value for the variable. If the variable has multiple selection defined for it, you may be able to select multiple values for the variable by holding down the Control key.
14. To run the query, click Next.
Note: DB2 Web Query Tool does not validate SQL. Be certain to use correct SQL syntax, table names, and column names when writing your query.
DB2 Web Query Tool runs the query, and displays the Query Data page. You can now view the message page, and specify how to display or export the query results.