在另一个存储过程中定义 Oracle 过程的语法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1929361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:42:00  来源:igfitidea点击:

What is the syntax to define an Oracle procedure within an another stored procedure?

oraclestored-proceduresplsql

提问by daveslab

After many Google and SO searches, I cannot find a definitive answer to this simple question:

经过多次 Google 和 SO 搜索后,我找不到这个简单问题的明确答案:

How can I define a procedure inside of another procedure to use?

如何在要使用的另一个过程中定义一个过程?

I know that there are nested blocks and nested procedures, but I haven't seen the exact syntax for what I want. i.e.

我知道有嵌套块和嵌套过程,但我还没有看到我想要的确切语法。IE

create or replace
PROCEDURE TOP_PROCEDURE
(...)
IS
-- nested procedure here?
BEGIN
  NULL;
END;

回答by Tony Andrews

create or replace
PROCEDURE TOP_PROCEDURE
(...)
IS
   variable NUMBER;
   PROCEDURE nested_procedure (...)
   IS
   BEGIN
     NULL;
   END;
   PROCEDURE another_nested_procedure (...)
   IS
   BEGIN
     NULL;
   END;
BEGIN
  NULL;
END;

Local procedures must be declared afteranything else (e.g. variables).

本地过程必须其他任何东西(例如变量)之后声明。