DB2 Server for VSE & VM: Interactive SQL Guide and Reference


Listing the Names of Stored Statements

To view the names and contents of stored statements, type:

   list sql *

This displays information similar to Figure 42.

Figure 42. A Display of the Stored SQL Statements

+--------------------------------------------------------------------------------+
|DEPT         SELECT DEPTNO,MGRNO FROM DEPARTMENT ORDER BY MGRNO                 |
|DEPT2        SELECT DEPTNO,MGRNO FROM DEPARTMENT ORDER BY DEPTN                 |
|MYQUERY      SELECT * FROM EMPLOYEE WHERE &1;                                   |
|ARI7620I You have           3 stored SQL statements.                            |
+--------------------------------------------------------------------------------+

Notice that only the first 50 characters of each statement are displayed.

You may wish to store a statement but are unsure if the stored name you want to use is already in use. Using the LIST SQL * command becomes tedious if there are many stored statements. Instead, you can list a specific stored statement by using its name in the LIST command. Type:

   list sql getsup

You receive a message indicating that GETSUP is not found, and you can use it as the new store name.

You can also use this form of the LIST command to view statements whose name you know. For example, type the following to view DEPT2:

   list sql dept2

You can use multiple statement names with the LIST command. For example, type:

   list sql dept myquery


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]