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

Managing SPJs in NonStop SQL/MX
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
6-14
Keeping SPJ Statements in OBEY Command Files
Keeping SPJ Statements in OBEY Command
Files
Consider keeping your SPJ statements in OBEY command files. That way, you can
quickly and easily create, drop, or reregister SPJs and grant or revoke privileges to the
SPJs, as needed. For more information, see:
OBEY Command Files on page 6-14
Regenerating CREATE PROCEDURE Statements on page 6-16
OBEY Command Files
An OBEY command file is either an OSS text file (odd-unstructured file, type 180) or a
Guardian EDIT file (type 101). For more information about the OBEY command, see
the SQL/MX Reference Manual.
CREATE PROCEDURE Statements in an OBEY Command
File
For example, the OBEY command file, createprocs.sql, contains a series of
CREATE PROCEDURE statements:
To create SPJs from an OBEY command file, issue the OBEY command in MXCI:
OBEY createprocs.sql;
?SECTION "CREATE SALES SPJs"
CREATE PROCEDURE samdbcat.sales.lowerprice()
EXTERNAL NAME 'Sales.lowerPrice'
EXTERNAL PATH '/usr/mydir/myclasses'
LANGUAGE JAVA
PARAMETER STYLE JAVA
MODIFIES SQL DATA;
...
?SECTION "CREATE PERSNL SPJs"
CREATE PROCEDURE samdbcat.persnl.adjustsalary(IN empnum NUMERIC(4),
IN percent FLOAT,
OUT newsalary NUMERIC(8,2))
EXTERNAL NAME 'Payroll.adjustSalary'
EXTERNAL PATH '/usr/mydir/myclasses'
LANGUAGE JAVA
PARAMETER STYLE JAVA
MODIFIES SQL DATA;
...
Note. The SPJ class must exist on the disk for the CREATE PROCEDURE statements to run
successfully.