What is Oracle Least Function?

Oracle SQL/PLSQL offers least function that will return least of values from a list provided. The syntax of the functions is:

LEAST (val1, val2, …valn)

Example:

SELECT least(10,9,35) low_value FROM dual;

The output is:

LOW_VALUE

---------------

9

Note: If there is at least one NULL value in the least, the output will be always NULL. This is because least will not be able to identify the next least value. For avoiding this problem always make sure of using either NVL or DECODE for passing values.

No comments :

Post a Comment