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

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

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

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

      1. 在 SQL Developer 中运行存储过程?

        时间:2023-10-26

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

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

                <tbody id='vNmtK'></tbody>

                  本文介绍了在 SQL Developer 中运行存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试运行具有多个输入和输出参数的存储过程.该过程只能通过导航其他用户 | 在我的连接面板中查看.|套餐 ||

                  I am trying to run a stored procedure that has multiple in and out paramaters. The procedure can only be viewed in my Connections panel by navigating Other Users | | Packages | |

                  如果我右键单击 ,菜单项是Order Members By..."和Create Unit Test"(变灰).当用户访问该过程时,似乎无法运行"该过程.

                  If I right click , the menu items are "Order Members By..." and "Create Unit Test" (greyed out). The ability to "Run" the procedure does not seem possible when it's accessed by user.

                  我一直在寻找如何创建匿名块的示例,以便我可以将过程作为 SQL 文件运行,但没有找到任何有效的方法.

                  I have been trying to find an example of how to create an anonymous block so that I can run the procedure as a SQL file, but haven't found anything that works.

                  有谁知道我如何从 SQL Developer 执行这个过程?我使用的是 2.1.1.64 版.

                  Does anyone know how I can execute this procedure from SQL Developer? I am using Version 2.1.1.64.

                  提前致谢!

                  编辑 1:

                  我想调用的过程有这个签名:

                  The procedure I want to call has this signature:

                  user.package.procedure(
                     p_1 IN  NUMBER,
                     p_2 IN  NUMBER,
                     p_3 OUT VARCHAR2,
                     p_4 OUT VARCHAR2,
                     p_5 OUT VARCHAR2,
                     p_6 OUT NUMBER)
                  

                  如果我像这样写我的匿名块:

                  If I write my anonymous block like this:

                  DECLARE
                     out1 VARCHAR2(100);
                     out2 VARCHAR2(100);
                     out3 VARCHAR2(100);
                     out4 NUMBER(100);
                  BEGIN
                     EXECUTE user.package.procedure (33,89, :out1, :out2, :out3, :out4);
                  END;
                  

                  我收到错误:

                  Bind Varialbe "out1" is NOT DECLCARED
                  anonymous block completed
                  

                  我尝试初始化 out* 变量:

                  I've tried initializing the out* variables:

                     out1 VARCHAR2(100) := '';
                  

                  但得到同样的错误:

                  编辑 2:

                  根据亚历克斯的回答,我尝试从参数前面删除冒号并得到这个:

                  Based on Alex's answer, I tried removing the colons from in front of the params and get this:

                  Error starting at line 1 in command:
                  DECLARE
                     out1 VARCHAR2(100);
                     out2 VARCHAR2(100);
                     out3 VARCHAR2(100);
                     out4 NUMBER(100);
                  BEGIN
                     EXECUTE user.package.procedure (33,89, out1, out2, out3, out4);
                  END;
                  Error report:
                  ORA-06550: line 13, column 17:
                  PLS-00103: Encountered the symbol "USER" when expecting one of the following:
                  
                     := . ( @ % ; immediate
                  The symbol ":=" was substituted for "USER" to continue.
                  06550. 00000 -  "line %s, column %s:
                  %s"
                  *Cause:    Usually a PL/SQL compilation error.
                  *Action:
                  

                  推荐答案

                  使用简单的参数类型(即不是引用等),您可以执行以下操作:

                  With simple parameter types (i.e. not refcursors etc.) you can do something like this:

                  SET serveroutput on;
                  DECLARE
                      InParam1 number;
                      InParam2 number;
                      OutParam1 varchar2(100);
                      OutParam2 varchar2(100);
                      OutParam3 varchar2(100);
                      OutParam4 number;
                  BEGIN
                      /* Assign values to IN parameters */
                      InParam1 := 33;
                      InParam2 := 89;
                  
                      /* Call procedure within package, identifying schema if necessary */
                      schema.package.procedure(InParam1, InParam2,
                          OutParam1, OutParam2, OutParam3, OutParam4);
                  
                      /* Display OUT parameters */
                      dbms_output.put_line('OutParam1: ' || OutParam1);
                      dbms_output.put_line('OutParam2: ' || OutParam2);
                      dbms_output.put_line('OutParam3: ' || OutParam3);
                      dbms_output.put_line('OutParam4: ' || OutParam4);
                  END;
                  /
                  

                  <小时>编辑以使用 OP 的规范,以及使用 :var 绑定变量的替代方法:


                  Edited to use the OP's spec, and with an alternative approach to utilise :var bind variables:

                  var InParam1 number;
                  var InParam2 number;
                  var OutParam1 varchar2(100);
                  var OutParam2 varchar2(100);
                  var OutParam3 varchar2(100);
                  var OutParam4 number;
                  
                  BEGIN
                      /* Assign values to IN parameters */
                      :InParam1 := 33;
                      :InParam2 := 89;
                  
                      /* Call procedure within package, identifying schema if necessary */
                      schema.package.procedure(:InParam1, :InParam2,
                          :OutParam1, :OutParam2, :OutParam3, :OutParam4);
                  END;
                  /
                  
                  -- Display OUT parameters
                  print :OutParam1;
                  print :OutParam2;
                  print :OutParam3;
                  print :OutParam4;
                  

                  这篇关于在 SQL Developer 中运行存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 phpMyAdmin 中查看我的存储过程? 下一篇:MySQL 存储过程权限

                  相关文章

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

                      <legend id='KlwZy'><style id='KlwZy'><dir id='KlwZy'><q id='KlwZy'></q></dir></style></legend>
                    1. <small id='KlwZy'></small><noframes id='KlwZy'>

                      <tfoot id='KlwZy'></tfoot>
                        <bdo id='KlwZy'></bdo><ul id='KlwZy'></ul>