Neoview Guide to Stored Procedures in Java (R2.3, R2.4)
Table 3-1 Mapping of Java Data Types to SQL Data Types
Maps to SQL Data Type...Java Data Type
CHAR[ACTER]
CHAR[ACTER] VARYING
VARCHAR
PIC[TURE] X
1
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
2
DEC[IMAL]
2
PIC[TURE] S9
3
java.math.BigDecimal
NUMERIC with a precision greater than eighteen
2
java.math.BigInteger
SMALLINT
2
short
INT[EGER]
2
int or java.lang.Integer
4
LARGEINT
2
long or java.lang.Long
4
FLOAT
double or java.lang.Double
4
REAL
float or java.lang.Float
4
DOUBLE PRECISION
double or java.lang.Double
4
None
java.sql.ResultSet[]
1 Neoview SQL stores PIC X as a CHAR data type.
2 Numeric data types of SQL parameters must be SIGNED, which is the default in Neoview SQL.
3 Neoview SQL stores PIC S9 as a DECIMAL or NUMERIC data type.
4 Choose a Java wrapper class if you plan to pass null values as arguments to or from the method. See “Null Input
and Output” (page 29).
Output parameters in the Java signature must be arrays (for example, int[] or String[]) that
accept only one value in the first element of the array at index 0. For more information, see
“Returning Output Values From the Java Method.”
Returning Output Values From the Java Method
The Java method can return data to the calling application in the form of output parameters or
result sets. Output parameters in the Java signature are parameter arrays that accept one value
in the first element of the array at index 0. Result sets in the Java signature are one-element
java.sql.ResultSet[] arrays that contain ResultSet objects that have multiple rows of
data. For more information about result sets, see “Returning Stored Procedure Result Sets”
(page 27). This subsection covers these topics related to output parameters:
• “Using Arrays for Output Parameters” (page 27)
• “Type Mapping of Output Parameters” (page 27)
26 Developing SPJ Methods