<i id='RsD0O'><tr id='RsD0O'><dt id='RsD0O'><q id='RsD0O'><span id='RsD0O'><b id='RsD0O'><form id='RsD0O'><ins id='RsD0O'></ins><ul id='RsD0O'></ul><sub id='RsD0O'></sub></form><legend id='RsD0O'></legend><bdo id='RsD0O'><pre id='RsD0O'><center id='RsD0O'></center></pre></bdo></b><th id='RsD0O'></th></span></q></dt></tr></i><div id='RsD0O'><tfoot id='RsD0O'></tfoot><dl id='RsD0O'><fieldset id='RsD0O'></fieldset></dl></div>

        <tfoot id='RsD0O'></tfoot>
      1. <small id='RsD0O'></small><noframes id='RsD0O'>

          <bdo id='RsD0O'></bdo><ul id='RsD0O'></ul>
        <legend id='RsD0O'><style id='RsD0O'><dir id='RsD0O'><q id='RsD0O'></q></dir></style></legend>
      2. 如何使用 Spring 持久化框架调用 Oracle 函数或存储过程?

        How to call Oracle function or stored procedure using spring persistence framework?(如何使用 Spring 持久化框架调用 Oracle 函数或存储过程?)

                <tfoot id='w3278'></tfoot>
                  <tbody id='w3278'></tbody>
                  <bdo id='w3278'></bdo><ul id='w3278'></ul>

                • <i id='w3278'><tr id='w3278'><dt id='w3278'><q id='w3278'><span id='w3278'><b id='w3278'><form id='w3278'><ins id='w3278'></ins><ul id='w3278'></ul><sub id='w3278'></sub></form><legend id='w3278'></legend><bdo id='w3278'><pre id='w3278'><center id='w3278'></center></pre></bdo></b><th id='w3278'></th></span></q></dt></tr></i><div id='w3278'><tfoot id='w3278'></tfoot><dl id='w3278'><fieldset id='w3278'></fieldset></dl></div>

                  <small id='w3278'></small><noframes id='w3278'>

                  <legend id='w3278'><style id='w3278'><dir id='w3278'><q id='w3278'></q></dir></style></legend>
                  本文介绍了如何使用 Spring 持久化框架调用 Oracle 函数或存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在为我的项目使用 Spring 持久性框架.我想从这个框架调用oracle函数或存储过程.

                  I am using Spring persistence framework for my project. I want to call oracle function or stored procedure from this framework.

                  任何人都可以建议我如何实现这一目标.

                  Can anybody suggest how can I achieve this.

                  请给出* oracle函数和*存储过程的解决方案.

                  Please give solution for both * oracle function and *stored procedure.

                  谢谢.

                  推荐答案

                  假设您指的是 JdbcTemplate:

                  Assuming you are referring to JdbcTemplate:

                  jdbcTemplate.execute(
                      new CallableStatementCreator() {
                          public CallableStatement createCallableStatement(Connection con) throws SQLException{
                              CallableStatement cs = con.prepareCall("{call MY_STORED_PROCEDURE(?, ?, ?)}");
                              cs.setInt(1, ...); // first argument
                              cs.setInt(2, ...); // second argument
                              cs.setInt(3, ...); // third argument
                              return cs;
                          }
                      },
                      new CallableStatementCallback() {
                          public Object doInCallableStatement(CallableStatement cs) throws SQLException{
                              cs.execute();
                              return null; // Whatever is returned here is returned from the jdbcTemplate.execute method
                          }
                      }
                  );
                  

                  调用函数几乎相同:

                  jdbcTemplate.execute(
                      new CallableStatementCreator() {
                          public CallableStatement createCallableStatement(Connection con) {
                              CallableStatement cs = con.prepareCall("{? = call MY_FUNCTION(?, ?, ?)}");
                              cs.registerOutParameter(1, Types.INTEGER); // or whatever type your function returns.
                              // Set your arguments
                              cs.setInt(2, ...); // first argument
                              cs.setInt(3, ...); // second argument
                              cs.setInt(4, ...); // third argument
                              return cs;
                          }
                      },
                      new CallableStatementCallback {
                          public Object doInCallableStatement(CallableStatement cs) {
                              cs.execute();
                              int result = cs.getInt(1);
                              return result; // Whatever is returned here is returned from the jdbcTemplate.execute method
                          }
                      }
                  );
                  

                  这篇关于如何使用 Spring 持久化框架调用 Oracle 函数或存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What can cause intermittent ORA-12519 (TNS: no appropriate handler found) errors(什么会导致间歇性 ORA-12519(TNS:找不到合适的处理程序)错误)
                  SQL to return the number of working days between 2 passed in dates(SQL 返回两个传入日期之间的工作日数)
                  Oracle Date Subtraction(Oracle 日期减法)
                  Is using quot;select *quot; for a cursor in PL/SQL considered bad programming?(正在使用“选择 *PL/SQL 中的游标被认为是糟糕的编程?)
                  Using sql/plsql, how do you find out which character set a text uses?(使用 sql/plsql,你如何找出文本使用的字符集?)
                  SQL finding person entry has the most dogs(SQL查找人员条目的狗最多)

                  • <bdo id='scKeF'></bdo><ul id='scKeF'></ul>
                    <legend id='scKeF'><style id='scKeF'><dir id='scKeF'><q id='scKeF'></q></dir></style></legend>
                      1. <tfoot id='scKeF'></tfoot>

                            <tbody id='scKeF'></tbody>
                            <i id='scKeF'><tr id='scKeF'><dt id='scKeF'><q id='scKeF'><span id='scKeF'><b id='scKeF'><form id='scKeF'><ins id='scKeF'></ins><ul id='scKeF'></ul><sub id='scKeF'></sub></form><legend id='scKeF'></legend><bdo id='scKeF'><pre id='scKeF'><center id='scKeF'></center></pre></bdo></b><th id='scKeF'></th></span></q></dt></tr></i><div id='scKeF'><tfoot id='scKeF'></tfoot><dl id='scKeF'><fieldset id='scKeF'></fieldset></dl></div>

                            <small id='scKeF'></small><noframes id='scKeF'>