Extended Stored Procedures Usage

Extended stored procedures (ESPs) provide a mechanism for calling external procedural language functions from within SAP ASE. Users invoke ESPs using the same syntax as stored procedures; the difference is that an ESP executes procedural language code rather than Transact-SQL statements.

Each ESP is associated with a corresponding function, which is executed when the ESP is invoked from SAP ASE.

An ESP allows SAP ASE to perform a task outside SAP ASE in response to an event occurring within SAP ASE. For example, you could create an ESP function to sell a security. This ESP is invoked in response to a trigger, fired when the price of the security reaches a certain value. Or you could create an ESP function that sends an e-mail notification or a network-wide broadcast in response to an event occurring within the relational database system.

For the purposes of ESPs, “a procedural language” is a programming language that is capable of calling a C language function and manipulating C-language datatypes.

After a function has been registered in a database as an ESP, it can be invoked just like a stored procedure from isql, from a trigger, from another stored procedure, or from a client application.

ESPs can:

SAP ASE supplies some system ESPs. For example, one system ESP, xp_cmdshell, executes an operating system command from within SAP ASE. You can also write your own ESPs using a subset of the Open Server application programming interface (API).