一、了解CallableStatement接口
1.callablestatement接口提供了两种调用形式
{?= call <procedure-name>[(<arg1>,<arg2>, …)]} //包含结果参数的调用形式 如:函数(funciton)
{call <procedure-name>[(<arg1>,<arg2>, …)]} //不包含结果参数的调用形式 如:存储过程(procedure)
2.callablestatement接口提供的方法
void registerOutParameter(int parameterIndex, int sqlType) throws SQLException; //在调用存储过程的时候设置输出参数的类型,用于接收输出结果
registerOutParameter接口中有四个该方法的重载实现,具体的可以查看源码了解
setXXX(int parameterIndex,XXX x) //主要用于设置过程调用时候需要的输入参数信息 其中XXX代表对应类型
getXXX(int x) //主要用于获取过程调用后返回的参数的信息
3.callablestatement接口产生的异常提示
/* * @exception SQLFeatureNotSupportedException if <code>sqlType</code> is * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>, * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>, * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>, * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code> * or <code>STRUCT</code> data type and the JDBC driver does not support