Friday, August 14, 2015

SP Inputs



cStmt.registerOutParameter("inOutParam", Types.INTEGER);
cStmt.setInt(2, 1);
int outputValue = cStmt.getInt(2);
----
getBigDecimal(int, int)
Get the value of a NUMERIC parameter as a java.math.BigDecimal object.
 o  getBoolean(int)
Get the value of a BIT parameter as a Java boolean.
 o  getByte(int)
Get the value of a TINYINT parameter as a Java byte.
 o  getBytes(int)
Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[]
 o  getDate(int)
Get the value of a SQL DATE parameter as a java.sql.Date object
 o  getDouble(int)
Get the value of a DOUBLE parameter as a Java double.
 o  getFloat(int)
Get the value of a FLOAT parameter as a Java float.
 o  getInt(int)
Get the value of an INTEGER parameter as a Java int.
 o  getLong(int)
Get the value of a BIGINT parameter as a Java long.
 o  getObject(int)
Get the value of a parameter as a Java object.
 o  getShort(int)
Get the value of a SMALLINT parameter as a Java short.
 o  getString(int)
Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String.
 o  getTime(int)
Get the value of a SQL TIME parameter as a java.sql.Time object.
 o  getTimestamp(int)
Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.
 o  registerOutParameter(int, int)
Before executing a stored procedure call, you must explicitly call registerOutParameter to register the java.sql.Type of each out parameter.
 o  registerOutParameter(int, int, int)
Use this version of registerOutParameter for registering Numeric or Decimal out parameters.
 o  wasNull()
callableStatement.setInt(1, 10);
callableStatement.registerOutParameter(2, java.sql.Types.VARCHAR);
callableStatement.registerOutParameter(3, java.sql.Types.VARCHAR);
callableStatement.registerOutParameter(4, java.sql.Types.DATE);
String userName = callableStatement.getString(2);
String createdBy = callableStatement.getString(3);
Date createdDate = callableStatement.getDate(4);

call.registerOutParameter(1, Types.INTEGER);

BIGINT  long[]    long
BINARY byte[][]                byte[]
BIT          boolean[]            boolean
DATE     java.sql.Date[]  java.sql.Date
DOUBLE               double[]              double
FLOAT   double[]              double
INTEGER              int[]       int
LONGVARBINARY            byte[][]                byte[]
REAL      float[]   float
SMALLINT           short[]  short
TIME      java.sql.Time[]  java.sql.Time
TIMESTAMP       java.sql.Timestamp[]     java.sql.Timestamp
VARBINARY


  • getBoolean()
  • getByte()
  • getBytes()
  • getDate()
  • getDouble()
  • getFloat()
  • getInt()
  • getLong()
  • getObject()
  • getShort()
  • getString()
  • getTime()
  • getTimestamp()
  • registerOutParamter()


No comments:

Post a Comment