CREATE PROCEDURE proc1(INOUT f1 char(50), INOUT f2 integer)
BEGIN f1 = new String("new rising sun"); f2 = new Integer("999"); END CREATE PROCEDURE proc2() BEGIN String in1 = new String("String type"); String out1 = new String(); Long out2 = new Long("0"); SQLCursor call_proc = new SQLCursor("call proc1(?, ?)"); call_proc.setParam(1,in1); // In setParam you can use either String or String type // for SQL types CHAR, and VARCHAR call_proc.setParam(2,new Long("111")); call_proc.open(); out1 = (String)call_proc.getParam(1,CHAR); // getParam requires String type for CHAR out2 = (Long)call_proc.getParam(2,INTEGER); call_proc.close(); END |
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
|