如何使用JdbcDaoSupport在没有输出参数的情况下执行可调用语句

时间:2016-01-05 12:38:18

标签: java spring

我的代码是:

public void deleteOption(final int quoteId, final int optionId) {
        this.getJdbcTemplate().execute(new CallableStatementCreator() {
            @Override
            public CallableStatement createCallableStatement(Connection con) throws SQLException {
                CallableStatement cs = (CallableStatement) con.prepareCall(
                        " BEGIN "+
                        "   NTNQUOTE.QUOTE_TAB.DELETE_QUOTE_OPTION(   ?,?  ); "+
                        " END;");

                cs.setInt(1, quoteId);
                cs.setInt(2, optionId);
                return cs;
            }
        }, new CallableStatementCallback<String>() {
            @Override
            public String doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
                cs.execute();
                return "SUCCESS";
            }
        });
    }

这里没有通过执行这个可调用语句的输出,但无论如何我必须不必要地返回一个字符串或什么, 有没有其他方法可以做到这一点

0 个答案:

没有答案