Table of ContentsPreviousNext

Ispirer             Ispirer

Ispirer SQLWays Database Migration Software

Executing Procedures and User-Defined Functions

This section describes an execution of procedures and user-defined functions from other procedures or functions in various databases and their conversion by SQLWays.

TABLE 38. Executes Procedures and User-Defined Functions
Microsoft SQL Server
[ @return_status = ]
[@par1=] {value | @variable [OUTPUT] | 
[,[@parN=] {value | @variable [OUTPUT] 
| [DEFAULT]]...
The EXECUTE statement is used to execute procedures and user-defined functions in Microsoft SQL Server.
@return_status is the value, returning by the function (procedure)
procedure_name - the name of the procedure (function)
@parN - the name of a procedure (function) parameter
The sample below calls the procedure proc2:
EXEC proc2
The following example calls f1 function with parameters 1 and @var1. The function returns a value in the @ret_val variable:
EXECUTE @ret_value = f1 1, @var1
[ return_status = ] 
([{ value | variable }])  
In order to execute a procedure or function in Oracle, you have to explicitly specify the name of the procedure (function) and its parameters in PL/SQL.
The following example calls the proc2 stored procedure with parameters 77 and `test'.
proc2 (77,'test');
In the example below, function func2 returns a value into the ret_func2 variable. The function takes one parameter - 0.
ret_func2:=func2(0) ;
Sybase Adaptive Server Anywhere
[@variable =] CALL procedure_name  
[@par1=] exp1 [,[@parN=] expN]... 
CALL invokes a procedure that has been previously created.
The argument list can be specified by position or by using keyword format:
� by position, the arguments will match up with the corresponding parameter in the parameter list for the procedure;
� by keyword, the arguments are matched up with the named parameters (par1, ..., parN).
Inside a procedure, a CALL statement can be used in a DECLARE statement when the procedure returns result sets (for example: in the DECLARE CURSOR statement).
Procedures can return an integer value (as a status indicator) using the RETURN statement.
EXEC[UTE] [@return_status =] 
[@par1=] {exp1 | @variable1 [OUTPUT]} 
[,[@parN=] {expN | @variableN 
EXECUTE invoke a procedure, optionally supplying procedure parameters and retrieving output values and return status information.
EXECUTE is Sybase Adaptive Server Enterprise-compatible alternative to the CALL statement.
@return_status is a value, which contains return status information.
@parN is the name of a procedure parameter.
The sample below executes the procedure p2:
The following example executes the procedure and stores the return value in the @ret_val variable:
EXECUTE @ret_value = p1 1

Table of ContentsPreviousNext
Ispirer             Ispirer
Copyright © 1999-2015 Ispirer Systems Ltd. Ispirer and SQLWays are trademarks of Ispirer Systems Ltd. All other product names may be trademarks of the respective companies. All rights reserved.