SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)
4 Registering SPJs in NonStop SQL/MX
This section covers these topics:
• Creating an SPJ (page 59)
• Using the CREATE PROCEDURE Statement (page 59)
• Dropping an SPJ (page 67)
• Altering an SPJ and Its Java Class (page 68)
This section assumes that you have already written and compiled the SPJ methods. For more
information, see Chapter 3: Writing SPJ Methods.
Creating an SPJ
The CREATE PROCEDURE statement registers an existing Java method as an SPJ within an SQL/MX
database. Registration of an SPJ enables any SQL/MX application or interface to execute the SPJ
method by using a CALL statement.
You can issue a CREATE PROCEDURE statement from any application or interface that calls NonStop
SQL/MX, such as:
• SQL/MX conversational interface (MXCI)
• Embedded SQL programs in C, C++, or COBOL
• JDBC/MX programs
• NonStop ODBC/MX clients
• NSM/web
NOTE: The catalog and schema of the SPJ must exist when you run the CREATE PROCEDURE
statement.
Required Privileges for Creating an SPJ
To issue a CREATE PROCEDURE statement, you must be the owner of the schema, or the super ID
(that is, super.super), and have read access to the Java class file or JAR file that contains the SPJ
method.
Effect of Creating an SPJ
When you execute a CREATE PROCEDURE statement, the identified Java method is verified to exist
in the Java class file and to have attributes that are consistent with those specified in the CREATE
PROCEDURE statement.
Successful execution of the CREATE PROCEDURE statement updates rows in the system metadata
tables and creates aprocedure label for the SPJ. If the CREATE PROCEDURE statement fails to
execute, NonStop SQL/MX does not update system metadata tables and does not create a
procedure label.
For more information, see the Effect of Registering an SPJ (page 21).
Using the CREATE PROCEDURE Statement
This subsection explains how to write a CREATE PROCEDURE statement, as shown in this example:
Creating an SPJ 59










