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-6
Specifying SQL Parameters
For information about SQL/MX data types, see the SQL/MX Reference Manual. For
cross-references to appropriate manuals for mappings of SQL/MX data types to
compatible data types in calling applications, see Section 5, Invoking SPJs in NonStop
SQL/MX.
Character String Parameters and Character Sets
For SQL parameters that have character string data types, you can specify either
ISO88591 or UCS2 (Unicode) for the character set. This example uses UCS2 as the
character set of the SQL parameter named lastname:
(IN empnum INT, OUT lastname CHAR(25) CHARACTER SET UCS2)
If you do not specify a character set, the default is ISO88591:
(IN empnum INT, OUT lastname CHAR(25))
Table 4-1. Mapping of SQL/MX Data Types to Java Data Types
SQL/MX Data Type Maps to Java Data Type...
CHAR[ACTER]*
CHAR[ACTER] VARYING *
VARCHAR*
PIC[TURE] X *
NCHAR
NCHAR VARYING
NATIONAL CHAR[ACTER]
NATIONAL CHAR[ACTER] VARYING
java.lang.String
DATE java.sql.Date
TIME java.sql.Time
TIMESTAMP java.sql.Timestamp
NUMERIC **
DEC[IMAL]**
PIC[TURE] S9
java.math.BigDecimal
SMALLINT** short
INT[EGER]** int (or java.lang.Integer if specified)***
LARGEINT long (or java.lang.Long if specified)***
FLOAT double (or java.lang.Double if specified)***
REAL float (or java.lang.Float if specified)***
DOUBLE PRECISION double (or java.lang.Double if specified)***
* The character set for character string data types can be ISO88591 or UCS2.
** Numeric data types must be SIGNED, which is the default in NonStop SQL/MX.
*** By default, the SQL/MX data type maps to a Java primitive data type. The SQL/MX data type maps to a
Java wrapper class only if you specify the wrapper class in the Java signature of the EXTERNAL NAME clause.
See the Java Method Signature
on page 4-8.
This icon indicates an SQL data type that is an SQL/MX extension to the ANSI standard. All other
SQL data types in this table conform to the ANSI standard.
Ext
Ext
Ext