Expressions

An expression is a series of operands and operators that you specify when you write a program or function script.

Each expression resolves to a particular type of value at run time. A numeric expression resolves to a number; a string expression resolves to a series of characters; a logical expression resolves to true or false; a datetime expression resolves to a date, interval, time, or timestamp.

Expressions are evaluated in accordance with a set of precedence rules and (within a given level of precedence) from left to right, but you can use parentheses to force a different ordering. A nested parenthetical subexpression is evaluated before the enclosing parenthetical subexpression, and all parenthetical expressions are evaluated before the expression as a whole.

At a given level of evaluation, the first operand determines the type of expression (or subexpression). Consider this example:
  "A value = " + 1 + 2
The first operand is of a character type, and the expression is a text expression with the following value:
  "A value = 12"
Consider a different text expression:
  "A value = " + (1 + 2)
The value in this case is as follows:
  "A value = 3"

Related reference
Datetime expressions
Logical expressions
Numeric expressions
Text expressions

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.