@@ -43,10 +43,6 @@ ql_statement
4343 ;
4444
4545select_statement
46- : select_query
47- ;
48-
49- select_query
5046 : select_clause from_clause (where_clause)? (groupby_clause)? (having_clause)? (orderby_clause)? (set_fuction)?
5147 ;
5248
@@ -57,11 +53,7 @@ setOperator
5753 ;
5854
5955set_fuction
60- : setOperator set_function_select
61- ;
62-
63- set_function_select
64- : select_query
56+ : setOperator select_statement
6557 ;
6658
6759update_statement
9587 ;
9688
9789fetch_join
98- : join_spec FETCH join_association_path_expression
90+ : join_spec FETCH join_association_path_expression AS ? identification_variable? join_condition?
9991 ;
10092
10193join_spec
@@ -315,7 +307,7 @@ scalar_expression
315307 | datetime_expression
316308 | boolean_expression
317309 | case_expression
318- | cast_expression
310+ | cast_function
319311 | entity_type_expression
320312 ;
321313
@@ -441,6 +433,7 @@ arithmetic_primary
441433 | functions_returning_numerics
442434 | aggregate_expression
443435 | case_expression
436+ | cast_function
444437 | function_invocation
445438 | ' (' subquery ' )'
446439 ;
@@ -453,7 +446,6 @@ string_expression
453446 | aggregate_expression
454447 | case_expression
455448 | function_invocation
456- | string_expression op=' ||' string_expression
457449 | ' (' subquery ' )'
458450 | string_expression ' ||' string_expression
459451 ;
@@ -539,8 +531,8 @@ functions_returning_strings
539531 | SUBSTRING ' (' string_expression ' ,' arithmetic_expression (' ,' arithmetic_expression)? ' )'
540532 | TRIM ' (' ((trim_specification)? (trim_character)? FROM )? string_expression ' )'
541533 | LOWER ' (' string_expression ' )'
542- | REPLACE ' (' string_expression ' ,' string_expression ' ,' string_expression ' )'
543534 | UPPER ' (' string_expression ' )'
535+ | REPLACE ' (' string_expression ' ,' string_expression ' ,' string_expression ' )'
544536 | LEFT ' (' string_expression ' ,' arithmetic_expression ' )'
545537 | RIGHT ' (' string_expression ' ,' arithmetic_expression ' )'
546538 ;
@@ -551,6 +543,9 @@ trim_specification
551543 | BOTH
552544 ;
553545
546+ cast_function
547+ : CAST ' (' single_valued_path_expression (identification_variable)? identification_variable (' (' numeric_literal (' ,' numeric_literal)* ' )' )? ' )'
548+ ;
554549
555550function_invocation
556551 : FUNCTION ' (' function_name (' ,' function_arg)* ' )'
@@ -615,9 +610,6 @@ nullif_expression
615610 : NULLIF ' (' scalar_expression ' ,' scalar_expression ' )'
616611 ;
617612
618- cast_expression
619- : CAST ' (' string_expression AS type_literal ' )'
620- ;
621613
622614/* ******************
623615 Gaps in the spec.
@@ -631,6 +623,7 @@ trim_character
631623identification_variable
632624 : IDENTIFICATION_VARIABLE
633625 | f=(COUNT
626+ | AS
634627 | DATE
635628 | FROM
636629 | INNER
@@ -646,6 +639,7 @@ identification_variable
646639 | TIME
647640 | TYPE
648641 | VALUE )
642+ | type_literal
649643 ;
650644
651645constructor_name
@@ -673,6 +667,9 @@ pattern_value
673667
674668date_time_timestamp_literal
675669 : STRINGLITERAL
670+ | DATELITERAL
671+ | TIMELITERAL
672+ | TIMESTAMPLITERAL
676673 ;
677674
678675entity_type_literal
@@ -965,9 +962,10 @@ ON : O N;
965962OR : O R ;
966963ORDER : O R D E R ;
967964OUTER : O U T E R ;
965+ POWER : P O W E R ;
966+ REGEXP : R E G E X P ;
968967REPLACE : R E P L A C E ;
969968RIGHT : R I G H T ;
970- POWER : P O W E R ;
971969ROUND : R O U N D ;
972970SELECT : S E L E C T ;
973971SET : S E T ;
@@ -997,8 +995,11 @@ NOT_EQUAL : '<>' | '!=' ;
997995
998996CHARACTER : ' \' ' (~ (' \' ' | ' \\ ' )) ' \' ' ;
999997IDENTIFICATION_VARIABLE : (' a' .. ' z' | ' A' .. ' Z' | ' \u0080 ' .. ' \ufffe ' | ' $' | ' _' ) (' a' .. ' z' | ' A' .. ' Z' | ' \u0080 ' .. ' \ufffe ' | ' 0' .. ' 9' | ' $' | ' _' )* ;
1000- STRINGLITERAL : ' \' ' (~ (' \' ' | ' \\ ' ))* ' \' ' ;
998+ STRINGLITERAL : ' \' ' (~ (' \' ' | ' \\ ' )| ' \\ ' )* ' \' ' ;
1001999JAVASTRINGLITERAL : ' "' ( (' \\ ' [btnfr" ']) | ~('" ' ))* ' " ';
10021000FLOATLITERAL : ('0' .. '9')* '.' ('0' .. '9')+ (E ('0' .. '9')+)* (F|D)?;
10031001INTLITERAL : ('0' .. '9')+ ;
1004- LONGLITERAL : ('0' .. '9')+L ;
1002+ LONGLITERAL : ('0' .. '9')+ L;
1003+ DATELITERAL : '{' D STRINGLITERAL '}';
1004+ TIMELITERAL : '{' T STRINGLITERAL '}';
1005+ TIMESTAMPLITERAL : '{' T S STRINGLITERAL '}';
0 commit comments