Oracle/PLSQL: Greatest Function
In Oracle/PLSQL, the greatest function returns the greatest value in a list of expressions.
The syntax for the greatest function is:
greatest( expr1, expr2, ... expr_n )
expr1, expr2, . expr_n are expressions that are evaluated by the greatest function.
If the datatypes of the expressions are different, all expressions will be converted to whatever datatype expr1 is.
If the comparison is based on a character comparison, one character is considered greater than another if it has a higher character set value.
Applies To:
- Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g
For example:
greatest(2, 5, 12, 3) would return 12 greatest('2', '5', '12', '3') would return '5' greatest('apples', 'oranges', 'bananas') would return 'oranges' greatest('apples', 'applis', 'applas') would return 'applis'
