SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)

However, if you specify INT for an SQL parameter and the underlying SPJ method uses
java.lang.Integer, you must specify the Java signature in the EXTERNAL NAME clause, as
shown:
The Java signature is case-sensitive and must be placed within parentheses. The signature must
specify each of the parameter data types in the order that they appear in the Java method definition
within the class file. Each Java data type that corresponds to an OUT or INOUT parameter must
be followed by empty square brackets ([ ]) to indicate that it is an array parameter:
CREATE PROCEDURE samdbcat.persnl.employeejob(IN empnum INT,
OUT jobcode INT)
EXTERNAL NAME 'Payroll.employeeJob(int,
java.lang.Integer [])'
An SPJ returns only one value to the first element of the array at index 0. An SPJ cannot return an
array of values to an OUT or INOUT parameter. For more information, see Returning Output Values
From the Java Method (page 50).
If you specify a Java signature string, NonStop SQL/MX verifies that the signature is a valid
mapping of the parameters of the specified method into Java data types. If the signature is invalid,
NonStop SQL/MX returns an error.
Even if you do not specify a Java signature string, NonStop SQL/MX generates a compressed
representation of the Java method signature and stores it in the TEXT metadata table. The compressed
signature conforms to the internal type signature emitted by the javap tool and the -s option (for
example, javap -sclassfile). NonStop SQL/MX returns an error if the compressed signature
exceeds 8192 characters. For more information about javap, see the NonStop Server for Java
Tools Reference Pages.
For example, consider the SPJ method, adjustSalary():
public static void adjustSalary(BigDecimal empNum,
double percent,
BigDecimal[] newSalary)
...
The Java signature of this method in the CREATE PROCEDURE statement, if you choose to specify
it, is:
(java.math.BigDecimal, double, java.math.BigDecimal[])
After you register the SPJ (that is, issue the CREATE PROCEDURE statement), you can display the
compressed Java signature in the TEXT metadata table. Issue this query:
SELECT SUBSTRING(TEXT,1,100) AS "Compressed Signature"
FROM samdbcat.definition_schema_version_vernum.text t,
nonstop_sqlmx_node.system_schema.all_uids u,
nonstop_sqlmx_node.system_schema.schemata s
WHERE t.object_uid = u.object_uid
AND u.object_name = 'ADJUSTSALARY'
AND u.schema_uid = s.schema_uid
AND s.schema_name = 'PERSNL';
The schema version number vernum for NonStop SQL/MX Releases 2.0, 2.1, and 2.2 is 1200.
Using the CREATE PROCEDURE Statement 65