Previous  Next          Contents  Index  Navigation  Glossary  Library


Expressions combine constants and variables with arithmetic operators (+, -, *, /) and functions to return a value of a certain data type. For example, the expression (3 + 2) returns a value of 5, and is of numeric data type.

The format of an expression is:


This means that a number of 'subexpressions' can combine in a single expression. For example, the subexpressions (3 + 2) and MONTHS_BETWEEN(start_date, end_date) can combine in a single expression as follows:

	(3 + 2) + MONTHS_BETWEEN(start_date, end_date)

Expressions can also be used inside functions, as in the following example:

	salary = GREATEST(minimum_wage, (hourly_rate * hours_worked))

Data Type of Expressions

The rules for determining the data type of an expression are simple. Operands in an expression are normally of the same data type, and this is normally the data type of the expression as a whole. For example, in the following expression all the operands are numeric and the expression itself is numeric:

	GREATEST(minimum_wage, (hourly_rate * hours_worked))

There are some exceptions to this. For example:

	DAYS_BETWEEN(date1, date2)
	MONTHS_BETWEEN(date1, date2)

These have date operands, but return a numeric value.

So the expression:

	4 + days_between(start_date, todays_date)

returns a numeric result.

         Previous  Next          Contents  Index  Navigation  Glossary  Library