Implicit data type conversion between SQL and Java types
- Last Updated: February 11, 2026
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
When the OpenEdge SQL Engine creates a stored procedure, it converts the type of any input and output parameters.
The java.lang package, part of the Java core classes, defines classes for all the primitive Java types that "wrap" values of the corresponding primitive type in an object. The OpenEdge SQL Engine converts the SQL data types declared for input and output parameters to one of these wrapper types, as shown in the following table.
Be sure to use wrapper types when declaring procedure variables
to use as arguments to the getValue, setParam,
and set methods. These methods take objects as
arguments and will generate compilation errors if you pass a primitive
type to them.
The following example illustrates the use of the Java wrapper
type Long for a SQL type INTEGER:
|
When the OpenEdge SQL Engine submits the Java class it creates from the stored procedure to the Java compiler, the compiler checks for data‑type consistency between the converted parameters and variables you declare in the body of the stored procedure.
To avoid type mismatch errors, use the data‑type mappings shown in the following table for declaring parameters and result‑set fields in the procedure specification and the Java variables in the procedure body.
| SQL type | Java methods | Java wrapper type |
|---|---|---|
CHAR, VARCHAR |
All | String |
CHAR, VARCHAR |
set, setParam |
String |
NUMERIC
|
All |
java.math.BigDecimal
|
DECIMAL
|
All |
java.math.BigDecimal
|
BIT
|
All | Boolean |
TINYINT
|
All | Byte[1] |
SMALLINT
|
All | Integer |
INTEGER
|
All | Integer |
BIGINT
|
All | Integer |
REAL
|
All | Float |
FLOAT
|
All | Double |
DOUBLE PRECISION
|
All | Double |
BINARY
|
All | Byte[ ] |
VARBINARY
|
All | Byte[ ] |
DATE
|
All |
java.sql.Date
|
TIME
|
All |
java.sql.Time
|
TIMESTAMP
|
All |
java.sql.Timestamp
|