LEAST
The SQL least function will give the least string.
Description & Usage
The Oracle LEAST function returns the smallest value in a list of expressions.
Syntax:
The syntax for the LEAST function in Oracle SQL/PLSQL is:
greatest (strng1, string2, string3 … stringn)
Parameters
strng1
The first expression to evaluate whether it is the smallest.
string2 … stringn
Optional. Additional expressions that are to be evaluated.
Ex:
select least('a', 'b', 'c'), least('satish','srinu','saketh') from dual;
output will be
least('a', 'b', 'c')
--------------------------
a
least('satish','srinu','saketh')
--------------------------
saketh
Here, this function work based on ASCII value.
output on tool

Some more Example
Let’s look at some of this function examples and explore how to use in the Oracle :
least(10,12,50,3,5)
----------------------------------
3
least('apples', 'oranges', 'bananas')
-----------------------------------------
apples
Note:-
- In this function If all parameters are null then it will display nothing. or If any parameters is null it will display nothing .
- If the datatypes of the expressions are different, all expressions will be converted to whatever datatype strng1 is.
Used in
This function can be used in the following versions of Oracle: Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i