I suspect that the syntax diagram for a plsql_block
as given in the
Oracle® Database PL/SQL Language Reference for Relese 2 is wrong.
(For reference, here's the current link to that document)
The following piece of PL/SQL compiles fine:
declare
cursor
cursor_definition
is select * from dual;
variable_declaration number;
begin
null;
end;
The following statements are assumptions that I make based on the piece of PL/SQL above and based on Oracle's syntax diagram.
The declare section (above) consists of a
cursor definition
followed by avariable declaration
(which in turn is anitem declaration
).An
item declaration
can only be an element of anitem list 1
.A
cursor definition
can only be an element of anitem list 2
.An
item list 2
can never be followed by anitem list 1
.
Now, the variable declaration
following the cursor definition
contradicts point 4. Therefore I conclude that the
syntax diagram is wrong.
Maybe I am overlooking something, in which case I'd be very grateful for pointing this out to me.
Please understand that a wrong syntax diagram per se is no big deal to me. But I am in the process of writing a PL/SQL parser and the parser stumbles for the exact situation given with the example PL/SQL code. So, in order to improve the parser, I'd like to have a more authorative sequence diagram.