The following table lists the expression grammar. 1
Col1 | C2 | Col3 |
Start |
:: = |
(Procedure|SimpleExpression<EOS> ) |
Procedure |
:: = |
(<PROC_BEGIN>ReturnDecl|<PROC_NAMED> ProcHeader ReturnDecl)<EOS> (VarDeclaration<EOS>|Statement )*<PEND> |
ReturnDecl |
:: = |
<RETURNS>DataType |
ProcHeader |
:: = |
(Identifier"("Variable(","Variable)*")"| Identifier"(" ")") |
VarDeclaration |
:: = |
(<DECLARE>Variable"="SimpleExpression| <DECLARE>Variable) |
Variable |
:: = |
DataType<IDENTIFIER> |
PrimaryExpression |
:: = |
Literal |
| | Name | |
| | "("Expression")" | |
| | Block | |
| | StatementExpression<EOS> | |
| | SwitchStatement | |
| | IfStatement | |
| | WhileStatement | |
| | DoStatement | |
| | ForStatement | |
| | BreakStatement | |
| | ContinueStatement | |
| | ReturnStatement | |
Block |
:: = |
"{"(Statement )*"}" |
StatementExpression |
:: = |
Assignment |
| | PostfixExpression | |
SwitchStatement |
:: = |
<SWITCH>"("Expression")""{"(SwitchLabel (Statement)*)*"}" |
SwitchLabel |
:: = |
<CASE>Expression":"|<DEFAULT_CASE>":") |
IfStatement |
:: = |
<IF>"("Expression")"Statement(<ELSE> Statement)? |
WhileStatement |
:: = |
<WHILE>"("Expression")"Statement |
DoStatement |
:: = |
<DO>Statement<WHILE>"("Expression")"<EOS> |
ForStatement |
:: = |
<FOR>"("(ForInit)?<EOS>(Expression)?<EOS> (ForUpdate)?")"Statement |
ForInit |
:: = |
Expression |
ForUpdate |
:: = |
StatementExpression |
BreakStatement |
:: = |
<BREAK><EOS> |
ContinueStatement |
:: = |
<CONTINUE><EOS> |
ReturnStatement |
:: = |
<RETURN>(Expression)?<EOS> |
Expression |
:: = |
Assignment |
| | SimpleExpression | |
SimpleExpression |
:: = |
ConditionalOrExpression |
ConditionalOrExpression |
:: = |
ConditionalAndExpression(<OR> ConditionalAndExpression)* |
ConditionalAndExpression |
:: = |
EqualityExpression(<AND>EqualityExpression)* |
EqualityExpression |
:: = |
InExpression |
| | LikeExpression | |
| |
RelationalExpression(<EQ> RelationalExpression|<NE> RelationalExpression)* |
|
RelationalExpression |
:: = |
NumericalExpression(<LT> NumericalExpression|<GT> NumericalExpression|<LE> NumericalExpression|<GE> NumericalExpression)* |
NumericalExpression |
:: = |
AdditiveExpression |
AdditiveExpression |
:: = |
MultiplicativeExpression ("+"MultiplicativeExpression|"-" MultiplicativeExpression)* |
MultiplicativeExpression |
:: = |
UnaryExpression("*"UnaryExpression|"/" UnaryExpression|"%" UnaryExpression)* |
LikeExpression1 |
:: = |
(InOrLikeSubject<LIKE>Literal<ESCAPE> Literal|InOrLikeSubject<LIKE>Literal) Example: concat( "VIN_INVOLVED","CLAIM_TYPE") LIKE 'ABCD' 'ABCDE' LIKE 'ABCD' |
InExpression2 |
:: = |
InOrLikeSubject<IN>"("Literal (","Literal)*")" Example: "SETTLEMENT_DATE" IN (1,2,3,4) round( "SETTLEMENT_DATE" ) IN (1,2,3,4) 'a' IN ('a','b', 'c') |
InOrLikeSubject |
:: = |
Literal |
| | Method | |
| | Name | |
UnaryExpression |
:: = |
"("Expression")" |
| | <NOT>UnaryExpression | |
| | ("+")UnaryExpression | |
| | ("-")UnaryExpression | |
| | PostfixExpression | |
| | Method | |
| | Name | |
| | Literal | |
PostFixExpression |
:: = |
PrimaryExpression("++"|"--") |
Identifier |
:: = |
<IDENTIFIER>|<QUOTED_IDENTIFIER>) |
Method |
:: = |
(Name"("ParmList")"|Name"(" ")") |
ParmList |
:: = |
Parameter ( "," Parameter )* |
Parameter |
:: = |
SimpleExpression |
Name |
:: = |
(Identifier "." Identifier ". "Identifier"."Identifier|Identifier". "Identifier"."Identifier|Identifier". "Identifier|Identifier) |
Literal |
:: = |
( <INTEGER_LITERAL> | <FLOATING_POINT_LITERAL> | <CHARACTER_LITERAL> | <BOOLEAN_LITERAL> | <NULL_LITERAL> ) |
- 1Restriction: The LIKE predicate only supports name operands with literals. That is, in the LIKE clause, the pattern and escape values must be literals; a value expression is not currently supported. The name operand on the left side must be a column or variable name; it cannot be an expression.
-
2Restriction: The In predicate only supports name operands with
literals, as is the case with LIKE
The following table lists words that cannot be used as variable names, procedure names, and so forth, as they might confuse the parser and cause grammatical errors.
Col1 |
Col2 |
Col3 |
Col4 |
---|---|---|---|
BREAK |
“break” |
“BREAK” |
|
CASE |
“case” |
“CASE” |
|
CONTINUE |
“continue” |
“CONTINUE” |
|
DECLARE |
“declare” |
“DECLARE” |
|
DEFAULT_CASE |
“default” |
“DEFAULT” |
|
ESCAPE |
“escape” |
“ESCAPE” |
|
DO |
“do” |
“DO” |
|
EOS |
“;” |
|
|
ELSE |
“else” |
“ELSE” |
|
FOR |
“for” |
“FOR” |
|
IF |
“if” |
“IF” |
|
IN |
“in” |
“IN” |
|
LIKE |
“like” |
“LIKE” |
|
NOT |
“!” |
“not” |
“NOT” |
RETURN |
“return” |
“RETURN” |
|
RETURNS |
“returns” |
“RETURNS” |
|
SWITCH |
“switch” |
“SWITCH” |
|
WHILE |
“while” |
“WHILE” |
|
PROC_BEGIN |
“begin” |
“BEGIN” |
|
PROC_NAMED: |
“procedure” |
“PROCEDURE” |
|
PEND |
“end” |
“END;” |
|
The following table lists characters and their corresponding letter abbreviations that should not be used to construct variable names.
Col1 |
Col2 |
Col3 |
Col4 |
Col5 |
Col6 |
Col7 |
---|---|---|---|---|---|---|
EQ |
“==” |
“eq” |
“EQ” |
“is” |
“IS” |
|
NE |
“!==” |
“ne” |
“NE” |
“<>” |
“is not” |
“IS NOT” |
GT |
gt |
> |
|
|
|
|
LT |
lt |
< |
|
|
|
|
GE |
ge |
>= |
|
|
|
|
LE |
le |
<= |
|
|
|
|
In addition to the characters that should not be used to construct variable names, you should not use symbols that have a special meaning, listed in the table below:
Symbol |
Definition |
---|---|
+ |
plus sign for add |
- |
minus sign for subtraction |
* |
multiplication sign |
/ |
division sign |
% |
used for calculating remainder |
= |
assignment symbol |
Other characters you should not use are ampersands &&, pipes ||, parentheses ( ), braces { }, semicolons, commas, or periods.
The table below lists variable types defined in a procedure.
|
|
|
|
|
---|---|---|---|---|
INTEGER_TYPE |
“integer” |
“INTEGER” |
“int” |
“INT” |
CHAR_TYPE |
“character” |
“CHARACTER” |
“char” |
“CHAR” |
BOOLEAN_TYPE |
“boolean” |
“BOOLEAN” |
|
|
DOUBLE_TYPE |
“double” |
“DOUBLE” |
|
|
DECIMAL_TYPE |
“decimal” |
“DECIMAL” |
“dec” |
“DEC” |