我有一个匿名的pl/sql块,其中包含一个声明的过程以及一个游标.如果我在光标之前声明该过程则失败.是否要求在程序之前声明游标?
pl/sql块中的声明顺序还有哪些其他规则?
这有效:
DECLARE
cursor cur is select 1 from dual;
procedure foo as begin null; end foo;
BEGIN
null;
END;
Run Code Online (Sandbox Code Playgroud)
这失败了,错误 PLS-00103: Encountered the symbol "CURSOR" when expecting one of the following: begin function package pragma procedure form
DECLARE
procedure foo as begin null; end foo;
cursor cur is select 1 from dual;
BEGIN
null;
END;
Run Code Online (Sandbox Code Playgroud)
Pet*_*ang 13
需要在包/函数之前声明游标,变量,常量和类型.
这个也会失败:
DECLARE
procedure foo as begin null; end foo;
x VARCHAR2(10);
BEGIN
null;
END;
Run Code Online (Sandbox Code Playgroud)