加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle – 匿名pl / sql块中的声明顺序

发布时间:2020-12-12 16:25:27 所属栏目:百科 来源:网络整理
导读:我有一个匿名的pl / sql块,其中包含一个声明的过程以及一个游标.如果我在光标之前声明该过程则失败.是否要求在程序之前声明游标? pl / sql块中的声明顺序还有哪些其他规则? 这有效: DECLARE cursor cur is select 1 from dual; procedure foo as begin nu
我有一个匿名的pl / sql块,其中包含一个声明的过程以及一个游标.如果我在光标之前声明该过程则失败.是否要求在程序之前声明游标?

pl / sql块中的声明顺序还有哪些其他规则?

这有效:

DECLARE
 cursor cur is select 1 from dual;
 procedure foo as begin null; end foo;
BEGIN
 null;
END;

这失败并出现错误PLS-00103:遇到以下其中一项时遇到符号“CURSOR”:begin function package pragma procedure form

DECLARE
 procedure foo as begin null; end foo;
 cursor cur is select 1 from dual;
BEGIN
 null;
END;
需要在包/函数之前声明游标,变量,常量和类型.

这个也会失败:

DECLARE
 procedure foo as begin null; end foo;
 x VARCHAR2(10);
BEGIN
 null;
END;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读