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

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

          <bdo id='axcZN'></bdo><ul id='axcZN'></ul>
      1. 获取后 %NOTFOUND 可以返回 null 吗?

        Can %NOTFOUND return null after a fetch?(获取后 %NOTFOUND 可以返回 null 吗?)

              • <bdo id='9enbK'></bdo><ul id='9enbK'></ul>

                  <tbody id='9enbK'></tbody>
                <tfoot id='9enbK'></tfoot>

                  <small id='9enbK'></small><noframes id='9enbK'>

                  <legend id='9enbK'><style id='9enbK'><dir id='9enbK'><q id='9enbK'></q></dir></style></legend>
                  <i id='9enbK'><tr id='9enbK'><dt id='9enbK'><q id='9enbK'><span id='9enbK'><b id='9enbK'><form id='9enbK'><ins id='9enbK'></ins><ul id='9enbK'></ul><sub id='9enbK'></sub></form><legend id='9enbK'></legend><bdo id='9enbK'><pre id='9enbK'><center id='9enbK'></center></pre></bdo></b><th id='9enbK'></th></span></q></dt></tr></i><div id='9enbK'><tfoot id='9enbK'></tfoot><dl id='9enbK'><fieldset id='9enbK'></fieldset></dl></div>
                1. 本文介绍了获取后 %NOTFOUND 可以返回 null 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这个问题提出了一个非常有趣的观点;Oracle 文档中关于 %NOTFOUND 在获取后是否可能为空似乎存在矛盾.是吗?

                  This question raised a very interesting point; there seems to be a contradiction in the Oracle documentation on whether it's possible for %NOTFOUND to be null after a fetch. Is it?

                  引用 11g 文档

                  注意:在例 6-16 中,如果 FETCH 从不获取一行,则 c1%NOTFOUND始终为 NULL,并且永远不会退出循环.防止无限循环,请改用此 EXIT 语句:EXIT WHEN c1%NOTFOUND OR(c1%NOTFOUND 为空);

                  Note: In Example 6-16, if FETCH never fetches a row, then c1%NOTFOUND is always NULL and the loop is never exited. To prevent infinite looping, use this EXIT statement instead: EXIT WHEN c1%NOTFOUND OR (c1%NOTFOUND IS NULL);

                  文档似乎直接自相矛盾,因为它还说明了以下内容,这意味着在获取后 %NOTFOUND cannot 为 null.

                  The documentation seems to directly contradict itself as it also says the following, which implies that after a fetch %NOTFOUND cannot be null.

                  %NOTFOUND(%FOUND 的逻辑相反)返回:
                  在显式游标打开之后但在第一次获取之前为 NULL
                  如果最近从显式游标中获取的数据返回了一行,则为 FALSE
                  否则为真

                  %NOTFOUND (the logical opposite of %FOUND) returns:
                  NULL after the explicit cursor is opened but before the first fetch
                  FALSE if the most recent fetch from the explicit cursor returned a row
                  TRUE otherwise

                  10g 文档类似的警告,这不一定是直接矛盾,因为它警告可能无法成功执行获取以显示此行为.

                  The 10g documentation has a similar warning, which isn't, necessarily, a direct contradiction as it warns that a fetch might not execute successfully in order for this behaviour to be exhibited.

                  在第一次获取之前,%NOTFOUND 评估为 NULL.如果 FETCH 从不成功执行,EXIT WHEN 条件从不为 TRUE,并且循环永远不会退出.为了安全起见,您可能需要使用以下内容改为退出语句:

                  Before the first fetch, %NOTFOUND evaluates to NULL. If FETCH never executes successfully, the EXIT WHEN condition is never TRUE and the loop is never exited. To be safe, you might want to use the following EXIT statement instead:

                  当 c1%NOTFOUND 或 c1%NOTFOUND 为空时退出;

                  EXIT WHEN c1%NOTFOUND OR c1%NOTFOUND IS NULL;

                  在什么情况下获取可能失败"或在执行获取后 %NOTFOUND 可能返回 null?

                  In what situations might a fetch either "fail" or might %NOTFOUND return null after a fetch has been executed?

                  推荐答案

                  我可以找到一个 fetch 可能失败的情况:

                  I can find a situation where a fetch can fail:

                  declare
                    i integer;
                    cursor c is
                      select 1 / 0 from dual;
                  begin
                    open c;
                  
                    begin
                      fetch c
                        into i;
                    exception
                      when others then
                        dbms_output.put_line('ex');
                    end;
                  
                    if c%notfound is null then
                      dbms_output.put_line('null');
                    elsif c%notfound then
                      dbms_output.put_line('true');
                    else
                      dbms_output.put_line('false');
                    end if;
                    close c;
                  
                  end;
                  

                  但这只会让你的问题更强烈,因为它会评估为空,无论是在 10g 还是 11g ...

                  But this only makes your question stronger since it will evaluate to null, neither in 10g nor in 11g ...

                  这篇关于获取后 %NOTFOUND 可以返回 null 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的重置序列)
                  • <bdo id='FauhF'></bdo><ul id='FauhF'></ul>

                    1. <i id='FauhF'><tr id='FauhF'><dt id='FauhF'><q id='FauhF'><span id='FauhF'><b id='FauhF'><form id='FauhF'><ins id='FauhF'></ins><ul id='FauhF'></ul><sub id='FauhF'></sub></form><legend id='FauhF'></legend><bdo id='FauhF'><pre id='FauhF'><center id='FauhF'></center></pre></bdo></b><th id='FauhF'></th></span></q></dt></tr></i><div id='FauhF'><tfoot id='FauhF'></tfoot><dl id='FauhF'><fieldset id='FauhF'></fieldset></dl></div>
                      <tfoot id='FauhF'></tfoot>
                    2. <small id='FauhF'></small><noframes id='FauhF'>

                        <tbody id='FauhF'></tbody>
                          1. <legend id='FauhF'><style id='FauhF'><dir id='FauhF'><q id='FauhF'></q></dir></style></legend>