In Oracle/PLSQL, the least function returns the smallest value in a list of expressions.
Syntax
The syntax for the least function is:
least( expr1, expr2, ... expr_n )
expr1, expr2, . expr_n are expressions that are evaluated by the least function.
Note
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 smaller than another if it has a lower character set value.
Having a NULL value in one of the expressions will return NULL as the least value.
Applies To
- Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
For Example
least(2, 5, 12, 3) | would return 2 |
least('2', '5', '12', '3') | would return '12' |
least('apples', 'oranges', 'bananas') | would return 'apples' |
least('apples', 'applis', 'applas') | would return 'applas' |
least('apples', 'applis', 'applas', null) | would return NULL |