Application Building Guide

Creating SQL Procedures

The DB2 Command Line Processor scripts in the sqllib/samples/sqlproc directory on UNIX, and the %DB2PATH%\samples\sqlproc directory on OS/2 and Windows, (those ending with the .db2 extension) execute the CREATE PROCEDURE statement that creates the stored procedure on the server. Before executing this statement you must connect to the database. Each CLP script has a corresponding client application file of the same name, with either a .sqc, or a .c extension.

Before running a CREATE PROCEDURE CLP script, connect to the sample database with the command:

   db2 connect to sample user userid using password

where userid and password are the user ID and password of the instance where the sample database is located.

To execute the CREATE PROCEDURE statement contained in the rsultset.db2 script file, enter the following command:

   db2 -td@ -vf rsultset.db2

Next, stop and restart DB2. Now, you can call the SQL procedures, as explained in Calling SQL Procedures, below.


[ Top of Page | Previous Page | Next Page ]