Skip to content

Commit e63a900

Browse files
authored
Update PlSqlParser.g4
- Added PIPELINE keyword in function spec rule - Added DETERMINISTIC keyword in function_body rule (it does not matter if DETERMINISTIC comes first or second after PIPELINED) - Added RENAME statement to unit_statement - Added EDITIONABLE statement to create_view rule - Re-engineered WITH clause (CTE) statement usability for create_view, create_materialzed_view, create_table bodies - Replaced '@' with AT_SIGN - Added EXISTS, PERIOD_KEYWORD to allowed object names (regular_ids)
1 parent becebc2 commit e63a900

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

sql/plsql/PlSqlParser.g4

+20-8
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ unit_statement
8888
| data_manipulation_language_statements
8989
| drop_table
9090
| drop_index
91+
92+
| rename_object
9193

9294
| comment_on_column
9395
| comment_on_table
@@ -176,7 +178,7 @@ procedure_spec
176178

177179
function_spec
178180
: FUNCTION identifier ('(' parameter ( ',' parameter)* ')')?
179-
RETURN type_spec (DETERMINISTIC)? (RESULT_CACHE)? ';'
181+
RETURN type_spec (PIPELINED)? (DETERMINISTIC)? (RESULT_CACHE)? ';'
180182
;
181183

182184
package_obj_body
@@ -204,7 +206,7 @@ alter_procedure
204206
function_body
205207
: FUNCTION identifier ('(' parameter (',' parameter)* ')')?
206208
RETURN type_spec (invoker_rights_clause | parallel_enable_clause | result_cache_clause | DETERMINISTIC)*
207-
((PIPELINED? (IS | AS) (DECLARE? seq_of_declare_specs? body | call_spec)) | (PIPELINED | AGGREGATE) USING implementation_type_name) ';'
209+
((PIPELINED? DETERMINISTIC? (IS | AS) (DECLARE? seq_of_declare_specs? body | call_spec)) | (PIPELINED | AGGREGATE) USING implementation_type_name) ';'
208210
;
209211

210212
procedure_body
@@ -1214,6 +1216,10 @@ sql_statement_shortcut
12141216
drop_index
12151217
: DROP INDEX index_name ';'
12161218
;
1219+
1220+
rename_object
1221+
: RENAME object_name TO object_name ';'
1222+
;
12171223

12181224
grant_statement
12191225
: GRANT
@@ -1301,9 +1307,9 @@ alter_view_editionable
13011307
;
13021308

13031309
create_view
1304-
: CREATE (OR REPLACE)? (OR? FORCE)? EDITIONING? VIEW
1310+
: CREATE (OR REPLACE)? (OR? FORCE)? EDITIONABLE? EDITIONING? VIEW
13051311
tableview_name view_options?
1306-
AS subquery subquery_restriction_clause?
1312+
AS select_only_statement subquery_restriction_clause?
13071313
;
13081314

13091315
view_options
@@ -1685,7 +1691,7 @@ create_materialized_view
16851691
create_mv_refresh?
16861692
(FOR UPDATE)?
16871693
( (DISABLE | ENABLE) QUERY REWRITE )?
1688-
AS subquery
1694+
AS select_only_statement
16891695
';'
16901696
;
16911697

@@ -1733,7 +1739,7 @@ create_cluster
17331739

17341740
create_table
17351741
: CREATE (GLOBAL TEMPORARY)? TABLE tableview_name
1736-
(relational_table | object_table | xmltype_table) (AS select_statement)?
1742+
(relational_table | object_table | xmltype_table) (AS select_only_statement)?
17371743
';'
17381744
;
17391745

@@ -3266,8 +3272,12 @@ explain_statement
32663272
FOR (select_statement | update_statement | delete_statement | insert_statement | merge_statement)
32673273
;
32683274

3275+
select_only_statement
3276+
: subquery_factoring_clause? subquery
3277+
;
3278+
32693279
select_statement
3270-
: subquery_factoring_clause? subquery (for_update_clause | order_by_clause | offset_clause | fetch_clause)*
3280+
: select_only_statement (for_update_clause | order_by_clause | offset_clause | fetch_clause)*
32713281
;
32723282

32733283
// Select Specific Clauses
@@ -4247,7 +4257,7 @@ column_name
42474257

42484258
tableview_name
42494259
: identifier ('.' id_expression)?
4250-
('@' link_name | /*TODO{!(input.LA(2) == BY)}?*/ partition_extension_clause)?
4260+
(AT_SIGN link_name | /*TODO{!(input.LA(2) == BY)}?*/ partition_extension_clause)?
42514261
| xmltable outer_join_sign?
42524262
;
42534263

@@ -4612,6 +4622,7 @@ regular_id
46124622
| EXCEPTION
46134623
| EXCEPTION_INIT
46144624
| EXCEPTIONS
4625+
| EXISTS
46154626
| EXIT
46164627
| FLOAT
46174628
| FORALL
@@ -4867,6 +4878,7 @@ non_reserved_keywords_in_12c
48674878
| PATTERN
48684879
| PER
48694880
| PERIOD
4881+
| PERIOD_KEYWORD
48704882
| PERMUTE
48714883
| PLUGGABLE
48724884
| POOL_16K

0 commit comments

Comments
 (0)