今天寫了個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();
}
}