我有一个匿名的pl/sql块,其中声明了一个过程以及一个游标。如果我在游标之前声明过程,它会失败。是否有要求在程序之前声明游标?声明在匿名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;
文档引用这里 http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/block.htm#i32791 它不是很清楚,但“项目声明”(如变量)在列表中1并且必须在“程序/函数定义”之前出现ich在列表2中。 – 2010-06-09 23:17:06
@Gary:非常好,谢谢! – 2010-06-10 14:51:50