SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)
For the syntax of the CALL statement, see the SQL/MX Reference Manual.
Specifying the Name of the SPJ
In the CALL statement, specify the name of an SPJ that you have already registered in NonStop
SQL/MX. Qualify the procedure name with the same catalog and schema that you specified in
the CREATE PROCEDURE statement. For example:
SET SCHEMA samdbcat.persnl;
CALL adjustsalary(202, 5.5, ?);
If you do not fully qualify the procedure name, NonStop SQL/MX qualifies it according to the
current settings of CATALOG and SCHEMA in the SYSTEM_DEFAULTS table. For more information,
see the SQL/MX Reference Manual.
Listing the Arguments of the SPJ
Each argument that you list in the CALL statement must correspond with the SQL parameter that
you specified in the CREATE PROCEDURE statement.
For example, if you registered the stored procedure with three SQL parameters (two IN parameters
and one OUT parameter), you must list three formal parameters, separated by commas, in the
CALL statement:
CALL samdbcat.persnl.adjustsalary(202, 5, ?);
If the SPJ does not accept arguments, you must specify empty parentheses, as shown:
CALL samdbcat.sales.lowerprice();
Data Conversion of Parameter Arguments
NonStop SQL/MX performs an implicit data conversion when the data type of a parameter argument
is compatible with but does not match the formal data type of the stored procedure. For stored
procedure input values, the conversion is from the actual argument value to the formal parameter
type. For stored procedure output values, the conversion is from the actual output value, which has
the data type of the formal parameter, to the declared type of the host variable or dynamic
parameter.
Input Parameter Arguments
To pass data to an IN or INOUT parameter of an SPJ, specify an SQL expression that evaluates
to a character, date-time, or numeric value. The SQL expression can evaluate to NULL provided
that the underlying Java parameter supports null values. For more information, see Null Input and
Output (page 52).
Using the CALL Statement 73










