Neoview Guide to Stored Procedures in Java (R2.5)
back any changes made to the database at the end of the CALL statement execution. However,
when AUTOCOMMIT is OFF, the current transaction remains active until the end of the client
session or until you explicitly commit or roll back the transaction.
To ensure an atomic unit of work when calling an SPJ, use the COMMIT WORK statement in
the calling application to commit the transaction when the CALL statement succeeds, and use
the ROLLBACK WORK statement to roll back the transaction when the CALL statement fails.
For more information about transaction management, see the Neoview SQL Reference Manual.
Multithreading
Neoview SQL manages a single thread of execution within an SPJ environment, even if the
application that issues a CALL statement is a multithreaded Java application. The CALL statements
in a multithreaded application can execute in a nonblocking manner, but the SPJ methods
underlying those CALL statements execute serially within a given SPJ environment.
Using the CALL Statement
To invoke a stored procedure, specify the name of the stored procedure and its arguments in a
CALL statement, as shown in Figure 7-1:
Figure 7-1 CALL Statement Elements
For the syntax of the CALL statement, see the Neoview SQL Reference Manual.
Specifying the Name of the SPJ
In the CALL statement, specify the name of an SPJ that you have already created in the Neoview
database. Qualify the procedure name with the same schema that you specified when you
registered the SPJ. For example:
CALL persnl.adjustsalary(202, 5.5, ?);
Or, for example:
SET SCHEMA persnl;
CALL adjustsalary(202, 5.5, ?);
If you do not fully qualify the procedure name, Neoview SQL qualifies the procedure according
to the schema of the current session.
Listing the Parameter Arguments of the SPJ
Each argument that you list in the CALL statement must correspond with an SQL parameter of
the SPJ. A result set in the Java signature of the SPJ method does not correspond with an SQL
parameter. Do not specify result sets in the argument list.
For example, if you registered the stored procedure with three SQL parameters (two IN parameters
and one OUT parameter), you must list three formal parameter arguments, separated by commas,
in the CALL statement:
CALL persnl.adjustsalary(202, 5, ?);
If the SPJ does not accept arguments, you must specify empty parentheses, as shown:
52 Executing SPJs