Home > Database > Mysql Tutorial > [Oracle]JDBCTemplate调用Oracle存储过程示例

[Oracle]JDBCTemplate调用Oracle存储过程示例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:19:06
Original
1152 people have browsed it

[Oracle]JDBCTemplate调用Oracle存储过程示例

[Oracle]JDBCTemplate调用Oracle存储过程示例

this.getJdbcTemplate().execute(
    new CallableStatementCreator() {
        public CallableStatement createCallableStatement(Connection con) throws SQLException {
        String storedProc = "{call updatetractractcode(?, ?)}";// 调用的存储过程
        CallableStatement cs = con.prepareCall(storedProc);
        cs.setInt(1, contractId);// 设置输入参数的值
        cs.registerOutParameter(2, java.sql.Types.INTEGER);// 注册输出参数的类型
        return cs;
        }
    }, new CallableStatementCallback() {
        public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
        cs.execute();
        return cs.getString(2);// 获取输出参数的值
    }
});

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template