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


Running a Routine

You run routines by using the ISQL RUN command. Use placeholders and parameters in the same manner as you would use them in stored SQL statements.

For example, type the following command and placeholder replacement values to run the QREPORT routine you created:

   run qreport ('ad3100' 180)

Routine QREPORT creates a printed report similar to that shown in Figure 46. The query result is printed rather than displayed because of the PRINT command contained in the routine. Producing a query result on the display is discussed later in this chapter under Using SELECT Statements in a Routine.

Figure 46. Example of a Report Created from a Routine

 .                                                                        .
 . 08/27/89   SELECT PROJNO,ACSTAFF FROM PROJ_ACT WHERE PROJNO = 'AD3     .
 .                                                                        .
 .                                                                        .
 .                                                                        .
 . PROJNO  ACSTAFF                                                        .
 . ______  _______                                                        .
 . AD3100     0.50                                                        .
 .         _______                                                        .
 . ******     0.50                                                        .
 .                                                                        .
 . AD3111     1.00                                                        .
 .         _______                                                        .
 . ******     1.00                                                        .
 .                                                                        .
 . AD3112     0.50                                                        .
 .         _______                                                        .
 . ******     0.50                                                        .
 .                                                                        .
 . AD3113     0.75                                                        .
 .            1.00                                                        .
 .            0.50                                                        .
 .         _______                                                        .
 . ******     2.25                                                        .
 .                                                                        .
 . MA2112     1.00                                                        .
 .            1.00                                                        .
 .                                                                        .


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