Progress
DataServer
for ODBC Guide
Running a Stored Procedure
The Progress 4GL statement RUN STORED–PROC allows you to run a stored procedure in the ODBC data source. You must also indicate the end of a stored procedure in your Progress procedure by using the CLOSE STORED–PROC statement.
This is the syntax for the RUN STORED–PROC statement:
This is the partial syntax for the CLOSE STORED–PROC statement:
For example, the following Progress 4GL code runs the stored procedure pcust:
This code first defines an integer variable named handle1 that serves as a handle for identifying the stored procedure. If you have only one active stored procedure, you do not have to specify a handle. However, it is good programming practice to use handles to identify all of your stored procedures.
It then runs the stored procedure as follows:
The Progress procedure next uses the CLOSE STORED–PROC statement to fetch the orders and states output parameters and then displays them. Note that the stored procedure does not return output parameter values unless you request them with the keyword OUTPUT or INPUT–OUTPUT when you execute the procedure.
You can close all stored procedures at once with the following statement:
NOTE: For Sybase and Microsoft SQL Server 6.5, the DataServer typically maintains one connection. If your application requires that you process other queries while a stored procedure is open, use the -Dsrv qt_separate_connection parameter or the QUERY–TUNING (SEPARATE–CONNECTION) option to specify that the DataServer use a separate connection for each statement that requires a cursor.See "Stored Procedure Reference," for a description of the complete syntax for the Progress statements and functions that support running stored procedures.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |