SQL/MX Guide to Stored Procedures in Java (G06.24+, H06.03+)

Registering SPJs in NonStop SQL/MX
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
4-4
Specifying SQL Parameters
Specifying SQL Parameters
If the SPJ method does not accept arguments, like the lowerPrice() method,
specify the procedure name with empty parentheses, as shown:
samdbcat.sales.lowerprice()
If the SPJ method accepts arguments, specify the corresponding SQL parameters.
Each SQL parameter consists of a parameter mode, an optional SQL identifier, and an
SQL data type, as shown:
Parameter Mode
The parameter mode specifies the input and output mode of an SQL parameter:
IN specifies a parameter that passes a single value to an SPJ.
INOUT specifies a parameter that passes a single value to and accepts a single
value from an SPJ.
OUT specifies a parameter that accepts a single value from an SPJ.
The default mode is IN if you do not specify the parameter mode. For a parameter
mode of OUT or INOUT, you must explicitly specify the parameter mode for the SQL
parameter.
In this example, all three parameters pass data to the SPJ, and the last parameter
accepts data from the SPJ:
samdbcat.sales.totalprice(IN qty NUMERIC(18),
IN rate VARCHAR(10),
INOUT price NUMERIC(18,2))
SQL Identifier
The SQL identifier is an optional name you can use to describe each SQL parameter
and to enhance the readability of the CREATE PROCEDURE statement. For example,
these identifiers describe the SQL parameters of the ADJUSTSALARY procedure:
samdbcat.persnl.adjustsalary(IN empnum NUMERIC(4),
IN percent FLOAT,
OUT newsalary NUMERIC(8,2))
VST017.vsd
(IN empnum NUMERIC(4), IN percent FLOAT, OUT newsalary NUMERIC(8,2))
Parameter
Mode
SQL Parameter SQL Parameter
SQL Parameter
SQL
Identifier
(optional)
SQL Data
Type