Skip to content

Commit d939aad

Browse files
author
Martin Karlgren
authored
[PlSql] Handle procedure_spec before variable_declaration (#3818)
To avoid parsing procedure specs without arguments as variable declarations.
1 parent 3d6b3be commit d939aad

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

sql/plsql/PlSqlParser.g4

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,12 @@ create_package_body
611611
package_obj_spec
612612
: pragma_declaration
613613
| exception_declaration
614+
| procedure_spec
615+
| function_spec
614616
| variable_declaration
615617
| subtype_declaration
616618
| cursor_declaration
617619
| type_declaration
618-
| procedure_spec
619-
| function_spec
620620
;
621621

622622
procedure_spec
@@ -631,14 +631,14 @@ function_spec
631631
package_obj_body
632632
: pragma_declaration
633633
| exception_declaration
634+
| procedure_spec
635+
| function_spec
634636
| subtype_declaration
635637
| cursor_declaration
636638
| variable_declaration
637639
| type_declaration
638640
| procedure_body
639641
| function_body
640-
| procedure_spec
641-
| function_spec
642642
;
643643

644644
// https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/alter-pmem-filestore.html
@@ -5285,12 +5285,12 @@ seq_of_declare_specs
52855285
declare_spec
52865286
: pragma_declaration
52875287
| exception_declaration
5288+
| procedure_spec
5289+
| function_spec
52885290
| variable_declaration
52895291
| subtype_declaration
52905292
| cursor_declaration
52915293
| type_declaration
5292-
| procedure_spec
5293-
| function_spec
52945294
| procedure_body
52955295
| function_body
52965296
;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
declare
2+
procedure proc;
3+
var number;
4+
begin
5+
null;
6+
end;
7+
/
8+
9+
create or replace package pkg is
10+
procedure proc;
11+
var number;
12+
end pkg;
13+
/

0 commit comments

Comments
 (0)