The EVALUATE statement is also used to call a method defined in the database.
In the EVALUATE statement, a method call is a term in an expression. If the method returns a constant value, another constant (or a method returning a constant) can also be a term in an expression. Both class and instance methods can be called by the EVALUATE statement.
EVALUATE expression [ ; ]
expression:
• [ + | - ] term [ { + | - | * | / } term ]
term:
• method_call
method_call :
• method_name ( call_target [, arg_value [ {, arg_value }_ ] ] ) [ to_variable ]
method_name ( [ arg_value [ {, arg_value }_ ] ] )
ON call_target [ to_variable ]
arg_value :
• literal
• variable
• expression
call_target :
• CLASS class_name
• variable
• expression
• method_call
to_variable :
• INTO variable
• TO variable
In the EVALUATE statement, the target argument for the specified method is represented in the parentheses following the method_name. The target can be the first field in the list, followed by method arguments. If the method executed is a class method, the CLASS keyword must precede the target class as the first field in the list. If only the method arguments are included in the parentheses, the call_target should be in the ON clause.
The EVALUATE statement also supports nested method calls by allowing one method call to be expressed as the target or the argument of another method. In these types of expressions, the result of the inner method is used to determine that of the outer method.