Execute ESPs

Execute an ESP using the same execute command that you use to execute a regular stored procedure.

You can also execute an ESP remotely.

Because the execution of any ESP involves a remote procedure call between SAP ASE and XP Server, you cannot combine parameters by name and parameters by value in the same execute command. All the parameters must be passed by name, or all must be passed by value. This is the only way in which the execution of extended stored procedures differs from that of regular stored procedures.

ESPs can return:

An ESP function reports the return status value with the srv_sendstatus Open Server routines. The return status values from srv_sendstatus are application-specific. However, a status of zero indicates that the request completed normally.

When there is no parameter declaration list for an extended stored procedure, SAP ASE ignores all supplied parameters but issues no error message. If you supply more parameters when you execute the ESP than you declare in the declaration list, SAP ASE calls them anyway. To avoid confusion about what parameters are called, check that the parameters on the declaration list match the parameters supplied at run-time. Also check the number of parameters in the specified ESP at the Open Server function build.

An ESP function returns the values of output parameters and result sets using the srv_descfmt, srv_bind, and srv_xferdata Open Server routine.

See the Open Server Server-Library/C Reference Manual for more information about passing values from an ESP function. From the SAP ASE side, returned values from an ESP are handled the same as for a regular stored procedure.

Related concepts
Create and Execute Stored Procedures
Execute Procedures Remotely
ESP Function Example