今天写了个oracle函数,但但对java如何调用不是很明白。
今天写了个,并且成功运行了。
Connection conn = null;
CallableStatement cstmt = null;
try {
conn = this.getJdbcTemplate().getDataSource().getConnection();
cstmt = conn.prepareCall("{call AUTO_TENDER_NVL(?)}");
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.setInt(1,89836);
cstmt.execute();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (cstmt != null) {
cstmt.close();
if (conn != null) {
conn.close();
}
}
} catch (SQLException e) {
System.out.println("SQL state" + e.getSQLState());
System.out.println("错误消息" + e.getMessage());
System.out.println("错误代码" + e.getErrorCode());
e.printStackTrace();
}
}
时间: 2024-10-20 04:27:33