首页 > 数据库技术 > 详细

java调用oracle函数

时间:2016-11-02 20:09:17      阅读:134      评论:0      收藏:0      [点我收藏+]

今天写了个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();
}
}

java调用oracle函数

原文:http://www.cnblogs.com/lijinlong/p/6024005.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!