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

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

        • <bdo id='aJSlE'></bdo><ul id='aJSlE'></ul>
      1. 为什么使用 EXECUTE IMMEDIATE 运行此查询会导致它失败?

        Why does running this query with EXECUTE IMMEDIATE cause it to fail?(为什么使用 EXECUTE IMMEDIATE 运行此查询会导致它失败?)

                <tbody id='8Eag2'></tbody>

            1. <legend id='8Eag2'><style id='8Eag2'><dir id='8Eag2'><q id='8Eag2'></q></dir></style></legend>

              <tfoot id='8Eag2'></tfoot>
                <bdo id='8Eag2'></bdo><ul id='8Eag2'></ul>
              • <small id='8Eag2'></small><noframes id='8Eag2'>

                <i id='8Eag2'><tr id='8Eag2'><dt id='8Eag2'><q id='8Eag2'><span id='8Eag2'><b id='8Eag2'><form id='8Eag2'><ins id='8Eag2'></ins><ul id='8Eag2'></ul><sub id='8Eag2'></sub></form><legend id='8Eag2'></legend><bdo id='8Eag2'><pre id='8Eag2'><center id='8Eag2'></center></pre></bdo></b><th id='8Eag2'></th></span></q></dt></tr></i><div id='8Eag2'><tfoot id='8Eag2'></tfoot><dl id='8Eag2'><fieldset id='8Eag2'></fieldset></dl></div>
                  本文介绍了为什么使用 EXECUTE IMMEDIATE 运行此查询会导致它失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写一个需要动态生成一些查询的 PL/SQL 过程,其中一个涉及使用作为参数的查询的结果创建临时表.

                  I am writing a PL/SQL procedure that needs to to dynamically generate some queries, one of which involves creating a temporary table using results from a query taken as a parameter.

                  CREATE OR REPLACE PROCEDURE sqlout(query IN VARCHAR2)
                  IS
                  BEGIN
                  EXECUTE IMMEDIATE  'CREATE GLOBAL TEMPORARY TABLE tmp_tab AS (' || query || ');';
                  END;
                  

                  它编译正确,但即使是非常简单的查询,例如:

                  It compiles correctly, but even with very simple queries such as with:

                  BEGIN
                      sqlout('SELECT * FROM DUAL');
                  END;
                  

                  IT 抛出 ORA-00911:无效字符.如果我手动运行创建的查询,它会正确运行.在这一点上,我能够确定导致问题的原因.

                  IT throws ORA-00911: invalid character. If I run the created query manually it runs correctly. At this point I am able to determine what is causing the problem.

                  推荐答案

                  尽量去掉;"从您立即执行的字符串内部.

                  Try to lose the ";" from inside the string that you Execute Immediate.

                  EXECUTE IMMEDIATE  'CREATE GLOBAL TEMPORARY TABLE tmp_tab AS (' || query || ')';
                  

                  这篇关于为什么使用 EXECUTE IMMEDIATE 运行此查询会导致它失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的重置序列)

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

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