【发布时间】:2010-06-09 14:54:27
【问题描述】:
我有一个匿名 pl/sql 块,其中声明了一个过程以及一个游标。如果我在游标之前声明该过程,它将失败。是否要求在过程之前声明游标?
pl/sql 块中的声明顺序还有哪些其他规则?
这行得通:
DECLARE
cursor cur is select 1 from dual;
procedure foo as begin null; end foo;
BEGIN
null;
END;
这会失败并出现错误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;
【问题讨论】: