Table of ContentsPreviousNext

Ispirer
Please, note, that Ispirer SQLWays 6.0 is no longer supported and provided to clients.
You can try out automated conversion of databases and applications with Ispirer Toolkit for free. Download free trial.
Check out the relevant toolkit documentation.
Ispirer Database Conversion overview.


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
Database
Syntax
Description
Microsoft SQL Server
 EXEC [UTE] 
[ @return_status = ]
procedure_name 
[
[@par1=] {value | @variable [OUTPUT] | 
[DEFAULT]
[,[@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
 
Examples:
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
Oracle
[ return_status = ] 
procedure_name 
([{ 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.
 
Examples:
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 =] 
[creator.]procedure_name  
[ 
[@par1=] {exp1 | @variable1 [OUTPUT]} 
[,[@parN=] {expN | @variableN 
[OUTPUT]}]... 
] 
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.
 
Examples:
The sample below executes the procedure p2:
EXECUTE 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
Copyright 1999-2023 Ispirer Systems.
Ispirer and SQLWays are registered trademarks. All other product names may be trademarks of the respective companies.
All rights reserved.