Monday, September 22, 2008

ESP - Extentded Stored Procedure

ESP is a stored procedure but instead contain SQL statements and control-of-flow statements, it executes compiled binary from dynamic link libary(dll).

ESP is used to perform tasks outside RDBMS, email notification for example, in response to an event.


RPC - Remote Stored Procedure Call

Code in a database can call stored procedure in another database.

The following code snippet is excerpted from Sybase

sp_addserver westcoastsrv, ASEnterprise, hqsales
begin transaction rpc_tran1
update sales set commission=300 where salesid="12OZ"
exec westcoastsrv.salesdb..recordsalesproc
commit rpc_tran1

or

sp_addobjectdef salesrec,
"westcoastsrv.salesdb..sales", "table"
begin transaction cis_tran1
update sales set commission=300 where salesid="12OZ"
update salesrec set commission=300 where salesid="12OZ"
commit cis_tran1

No comments: