JAVA调用ORACLE存储过程出错
代码publicvoidunpack(Stringpc,Stringxqdm)throwsSQLException{Sessionsession=getHibernate...
代码
public void unpack(String pc,String xqdm)throws SQLException {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
Connection conn = session.connection();
// CallableStatement cstmt = null;
try {
CallableStatement cstmt = conn.prepareCall("{Call PKG_I_DFXM.PRC_I_NBBPCF(?,?,?,?,?)");
cstmt.setString(1, pc);
cstmt.setString(2, xqdm);
cstmt.setString(3, "n");
cstmt.registerOutParameter(4, OracleTypes.NUMBER);
cstmt.registerOutParameter(5, OracleTypes.VARCHAR);
cstmt.execute();
// int xcode = cstmt.getInt(4);
// String errormsg = cstmt.getString(5);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
错误代码
不好意思阿,只有5的财富可悬赏了
java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.StringIndexOutOfBoundsException: String index out of range: 40
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62)
at 展开
public void unpack(String pc,String xqdm)throws SQLException {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
Connection conn = session.connection();
// CallableStatement cstmt = null;
try {
CallableStatement cstmt = conn.prepareCall("{Call PKG_I_DFXM.PRC_I_NBBPCF(?,?,?,?,?)");
cstmt.setString(1, pc);
cstmt.setString(2, xqdm);
cstmt.setString(3, "n");
cstmt.registerOutParameter(4, OracleTypes.NUMBER);
cstmt.registerOutParameter(5, OracleTypes.VARCHAR);
cstmt.execute();
// int xcode = cstmt.getInt(4);
// String errormsg = cstmt.getString(5);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
错误代码
不好意思阿,只有5的财富可悬赏了
java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.StringIndexOutOfBoundsException: String index out of range: 40
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62)
at 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询