@@ -3558,12 +3558,27 @@ func_application
35583558
35593559func_expr
35603560 : func_application within_group_clause? filter_clause? over_clause?
3561+ | json_aggregate_func filter_clause? over_clause?
35613562 | func_expr_common_subexpr
35623563 ;
35633564
35643565func_expr_windowless
35653566 : func_application
35663567 | func_expr_common_subexpr
3568+ | json_aggregate_func
3569+ ;
3570+
3571+ json_aggregate_func
3572+ : JSON_OBJECTAGG OPEN_PAREN json_name_and_value json_object_constructor_null_clause? json_key_uniqueness_constraint? json_output_clause? CLOSE_PAREN
3573+ | JSON_ARRAYAGG OPEN_PAREN json_value_expr json_array_aggregate_order_by_clause? json_array_constructor_null_clause? json_output_clause? CLOSE_PAREN
3574+ ;
3575+
3576+ json_output_clause
3577+ : RETURNING typename json_format_clause?
3578+ ;
3579+
3580+ json_array_aggregate_order_by_clause
3581+ : ORDER BY sortby_list
35673582 ;
35683583
35693584func_expr_common_subexpr
@@ -3599,6 +3614,125 @@ func_expr_common_subexpr
35993614 | XMLPI OPEN_PAREN NAME_P collabel (COMMA a_expr)? CLOSE_PAREN
36003615 | XMLROOT OPEN_PAREN XML_P a_expr COMMA xml_root_version opt_xml_root_standalone? CLOSE_PAREN
36013616 | XMLSERIALIZE OPEN_PAREN document_or_content a_expr AS simpletypename CLOSE_PAREN
3617+ | JSON_OBJECT ' (' func_arg_list ' )'
3618+ | JSON_OBJECT ' (' json_name_and_value_list json_object_constructor_null_clause? json_key_uniqueness_constraint? json_returning_clause? ' )'
3619+ | JSON_OBJECT ' (' json_returning_clause? ' )'
3620+ | JSON_ARRAY ' (' json_value_expr_list json_array_constructor_null_clause? json_returning_clause? ' )'
3621+ | JSON_ARRAY ' (' select_no_parens json_format_clause_opt? json_returning_clause? ' )'
3622+ | JSON_ARRAY ' (' json_returning_clause? ' )'
3623+ | JSON ' (' json_value_expr json_key_uniqueness_constraint? ' )'
3624+ | JSON_SCALAR ' (' a_expr ' )'
3625+ | JSON_SERIALIZE ' (' json_value_expr json_returning_clause? ' )'
3626+ | MERGE_ACTION ' (' ' )'
3627+ | JSON_QUERY ' ('
3628+ json_value_expr ' ,' a_expr json_passing_clause?
3629+ json_returning_clause?
3630+ json_wrapper_behavior
3631+ json_quotes_clause?
3632+ json_behavior_clause?
3633+ ' )'
3634+ | JSON_EXISTS ' ('
3635+ json_value_expr ' ,' a_expr json_passing_clause?
3636+ json_on_error_clause?
3637+ ' )'
3638+ | JSON_VALUE ' ('
3639+ json_value_expr ' ,' a_expr json_passing_clause?
3640+ json_returning_clause?
3641+ json_behavior_clause?
3642+ ' )'
3643+ ;
3644+
3645+ json_on_error_clause
3646+ : json_behavior ON ERROR
3647+ ;
3648+
3649+ json_behavior_clause
3650+ : json_behavior ON EMPTY
3651+ | json_behavior ON ERROR
3652+ | json_behavior ON EMPTY json_behavior ON ERROR
3653+ ;
3654+
3655+ json_behavior
3656+ : DEFAULT a_expr
3657+ | json_behavior_type
3658+ ;
3659+
3660+ json_behavior_type
3661+ : ERROR
3662+ | NULL_P
3663+ | TRUE_P
3664+ | FALSE_P
3665+ | UNKNOWN
3666+ | EMPTY ARRAY
3667+ | EMPTY OBJECT_P
3668+ | EMPTY
3669+ ;
3670+
3671+ json_quotes_clause
3672+ : (KEEP | OMIT ) QUOTES (ON SCALAR STRING )
3673+ ;
3674+
3675+ json_wrapper_behavior
3676+ : WITHOUT ARRAY ? WRAPPER
3677+ | WITH (CONDITIONAL | UNCONDITIONAL )? ARRAY ? WRAPPER
3678+ ;
3679+
3680+ json_passing_clause
3681+ : PASSING json_arguments
3682+ ;
3683+
3684+ json_arguments
3685+ : json_argument (COMMA json_argument)*
3686+ ;
3687+
3688+ json_argument
3689+ : json_value_expr AS collabel
3690+ ;
3691+
3692+ json_format_clause_opt
3693+ : FORMAT JSON ENCODING name
3694+ | FORMAT JSON
3695+ ;
3696+
3697+ json_value_expr_list
3698+ : json_value_expr (COMMA json_value_expr)*
3699+ ;
3700+
3701+ json_returning_clause
3702+ : RETURNING typename json_format_clause?
3703+ ;
3704+
3705+ json_key_uniqueness_constraint
3706+ : WITH UNIQUE KEYS ?
3707+ | WITHOUT UNIQUE KEYS ?
3708+ ;
3709+
3710+ json_array_constructor_null_clause
3711+ : NULL_P ON NULL_P
3712+ | ABSENT ON NULL_P
3713+ ;
3714+
3715+ json_object_constructor_null_clause
3716+ : NULL_P ON NULL_P
3717+ | ABSENT ON NULL_P
3718+ ;
3719+
3720+ json_name_and_value_list
3721+ : json_name_and_value (COMMA json_name_and_value)*
3722+ ;
3723+
3724+ json_name_and_value
3725+ : c_expr VALUE_P json_value_expr
3726+ | a_expr COLON json_value_expr
3727+ ;
3728+
3729+ json_value_expr
3730+ : a_expr json_format_clause?
3731+ ;
3732+
3733+ json_format_clause
3734+ : FORMAT JSON ENCODING name
3735+ | FORMAT JSON
36023736 ;
36033737
36043738xml_root_version
@@ -4056,6 +4190,7 @@ plsqlidentifier
40564190
40574191unreserved_keyword
40584192 : ABORT_P
4193+ | ABSENT
40594194 | ABSOLUTE_P
40604195 | ACCESS
40614196 | ACTION
@@ -4147,6 +4282,7 @@ unreserved_keyword
41474282 | FIRST_P
41484283 | FOLLOWING
41494284 | FORCE
4285+ | FORMAT
41504286 | FORWARD
41514287 | FUNCTION
41524288 | FUNCTIONS
@@ -4178,7 +4314,9 @@ unreserved_keyword
41784314 | INSTEAD
41794315 | INVOKER
41804316 | ISOLATION
4317+ | JSON
41814318 | KEY
4319+ | KEYS
41824320 | LABEL
41834321 | LANGUAGE
41844322 | LARGE_P
@@ -4307,6 +4445,7 @@ unreserved_keyword
43074445 | STORAGE
43084446 | STORED
43094447 | STRICT_P
4448+ | STRING
43104449 | STRIP_P
43114450 | SUBSCRIPTION
43124451 | SUPPORT
@@ -4376,6 +4515,10 @@ col_name_keyword
43764515 | INT_P
43774516 | INTEGER
43784517 | INTERVAL
4518+ | JSON_ARRAY
4519+ | JSON_ARRAYAGG
4520+ | JSON_OBJECT
4521+ | JSON_OBJECTAGG
43794522 | LEAST
43804523 | NATIONAL
43814524 | NCHAR
0 commit comments