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

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

    <legend id='RyC7H'><style id='RyC7H'><dir id='RyC7H'><q id='RyC7H'></q></dir></style></legend>
  1. <tfoot id='RyC7H'></tfoot>
    • <bdo id='RyC7H'></bdo><ul id='RyC7H'></ul>
    1. 如何获取受存储过程影响的记录数?

      How can I get the number of records affected by a stored procedure?(如何获取受存储过程影响的记录数?)

            <bdo id='NF4vK'></bdo><ul id='NF4vK'></ul>

                  <tbody id='NF4vK'></tbody>
                <legend id='NF4vK'><style id='NF4vK'><dir id='NF4vK'><q id='NF4vK'></q></dir></style></legend>

              1. <small id='NF4vK'></small><noframes id='NF4vK'>

                <tfoot id='NF4vK'></tfoot>
                <i id='NF4vK'><tr id='NF4vK'><dt id='NF4vK'><q id='NF4vK'><span id='NF4vK'><b id='NF4vK'><form id='NF4vK'><ins id='NF4vK'></ins><ul id='NF4vK'></ul><sub id='NF4vK'></sub></form><legend id='NF4vK'></legend><bdo id='NF4vK'><pre id='NF4vK'><center id='NF4vK'></center></pre></bdo></b><th id='NF4vK'></th></span></q></dt></tr></i><div id='NF4vK'><tfoot id='NF4vK'></tfoot><dl id='NF4vK'><fieldset id='NF4vK'></fieldset></dl></div>
              2. 本文介绍了如何获取受存储过程影响的记录数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                对于直接针对数据库执行的INSERTUPDATEDELETE SQL 语句,大多数数据库提供程序返回受影响的行数.对于存储过程,受影响的记录数总是-1.

                For INSERT, UPDATE and DELETE SQL statements executed directly against the database, most database providers return the count of rows affected. For stored procedures, the number of records affected is always -1.

                我们如何获取受存储过程影响的记录数?

                How do we get the number of records affected by a stored procedure?

                推荐答案

                为存储过程注册一个out参数,如果使用SQL Server,根据@@ROWCOUNT设置值.如果您使用的是 Oracle,请使用 SQL%ROWCOUNT.

                Register an out parameter for the stored procedure, and set the value based on @@ROWCOUNT if using SQL Server. Use SQL%ROWCOUNT if you are using Oracle.

                请注意,如果您有多个 INSERT/UPDATE/DELETE,您将需要一个变量来存储每个操作的 @@ROWCOUNT 结果.

                Mind that if you have multiple INSERT/UPDATE/DELETE, you'll need a variable to store the result from @@ROWCOUNT for each operation.

                这篇关于如何获取受存储过程影响的记录数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                How to redirect the output of DBMS_OUTPUT.PUT_LINE to a file?(如何将 DBMS_OUTPUT.PUT_LINE 的输出重定向到文件?)
                How do I get column datatype in Oracle with PL-SQL with low privileges?(如何使用低权限的 PL-SQL 在 Oracle 中获取列数据类型?)
                Get a list of all functions and procedures in an Oracle database(获取 Oracle 数据库中所有函数和过程的列表)
                Why cannot I create triggers on objects owned by SYS?(为什么我不能在 SYS 拥有的对象上创建触发器?)
                Returning result even for elements in IN list that don#39;t exist in table(即使对于表中不存在的 IN 列表中的元素也返回结果)
                Reset Sequence in oracle 11g(oracle 11g 中的重置序列)

                  <tfoot id='PPh4J'></tfoot>

                    • <bdo id='PPh4J'></bdo><ul id='PPh4J'></ul>

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

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

                            <tbody id='PPh4J'></tbody>