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

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

      <legend id='vPUjA'><style id='vPUjA'><dir id='vPUjA'><q id='vPUjA'></q></dir></style></legend>

        在 Oracle 中调用另一个存储过程

        Call a stored procedure with another in Oracle(在 Oracle 中调用另一个存储过程)
          <bdo id='XDthx'></bdo><ul id='XDthx'></ul>
            <tbody id='XDthx'></tbody>
          • <legend id='XDthx'><style id='XDthx'><dir id='XDthx'><q id='XDthx'></q></dir></style></legend>

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

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

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

                  问题描述

                  有谁知道从另一个内部调用存储过程的方法,或者即使可能的话?如果是这样,你会怎么做?

                  Does anyone know of a way, or even if its possible, to call a stored procedure from within another? If so, how would you do it?

                  这是我的测试代码:

                  SET SERVEROUTPUT ON;
                  
                  DROP PROCEDURE test_sp_1;
                  DROP PROCEDURE test_sp;
                  
                  CREATE PROCEDURE test_sp
                  AS
                  BEGIN
                      DBMS_OUTPUT.PUT_LINE('Test works');
                  END;
                  /
                  
                  CREATE PROCEDURE test_sp_1
                  AS
                  BEGIN
                      DBMS_OUTPUT.PUT_LINE('Testing');
                      test_sp;
                  END;
                  /
                  
                  CALL test_sp_1;
                  

                  推荐答案

                  您的存储过程按编码工作.问题出在最后一行,它无法调用您的任何一个存储过程.

                  Your stored procedures work as coded. The problem is with the last line, it is unable to invoke either of your stored procedures.

                  SQL*Plus 中的三个选项是:callexec 和一个匿名的 PL/SQL 块.

                  Three choices in SQL*Plus are: call, exec, and an anoymous PL/SQL block.

                  call 似乎是一个 SQL 关键字,并记录在 SQL 参考中.http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4008.htm#BABDEHHG 语法图表明需要括号,即使没有参数传递给调用例程.

                  call appears to be a SQL keyword, and is documented in the SQL Reference. http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4008.htm#BABDEHHG The syntax diagram indicates that parentesis are required, even when no arguments are passed to the call routine.

                  CALL test_sp_1();
                  

                  匿名 PL/SQL 块是不在命名过程、函数、触发器等内部的 PL/SQL.它可用于调用您的过程.

                  An anonymous PL/SQL block is PL/SQL that is not inside a named procedure, function, trigger, etc. It can be used to call your procedure.

                  BEGIN
                      test_sp_1;
                  END;
                  /
                  

                  Exec 是一个 SQL*Plus 命令,它是上述匿名块的快捷方式.EXEC 将作为 BEGIN 传递给数据库服务器;结束;

                  Exec is a SQL*Plus command that is a shortcut for the above anonymous block. EXEC <procedure_name> will be passed to the DB server as BEGIN <procedure_name>; END;

                  完整示例:

                  SQL> SET SERVEROUTPUT ON
                  SQL> CREATE OR REPLACE PROCEDURE test_sp 
                    2  AS 
                    3  BEGIN 
                    4      DBMS_OUTPUT.PUT_LINE('Test works'); 
                    5  END;
                    6  /
                  
                  Procedure created.
                  
                  SQL> CREATE OR REPLACE PROCEDURE test_sp_1 
                    2  AS
                    3  BEGIN
                    4      DBMS_OUTPUT.PUT_LINE('Testing'); 
                    5      test_sp; 
                    6  END;
                    7  /
                  
                  Procedure created.
                  
                  SQL> CALL test_sp_1();
                  Testing
                  Test works
                  
                  Call completed.
                  
                  SQL> exec test_sp_1
                  Testing
                  Test works
                  
                  PL/SQL procedure successfully completed.
                  
                  SQL> begin
                    2      test_sp_1;
                    3  end;
                    4  /
                  Testing
                  Test works
                  
                  PL/SQL procedure successfully completed.
                  
                  SQL> 
                  

                  这篇关于在 Oracle 中调用另一个存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                        <tbody id='PaSyW'></tbody>

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

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

                          <legend id='PaSyW'><style id='PaSyW'><dir id='PaSyW'><q id='PaSyW'></q></dir></style></legend>

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