• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql

syntax and example of least function in oracle sql

LEAST Function in Oracle SQL – PLSQL

November 6, 2012 by techhoneyadmin

The LEAST function in Oracle SQL / PLSQL is used to get the least or smallest value out of the expressions provided
The Syntax for the LEAST function in Oracle SQL / PLSQL is:

SELECT LEAST(expression1, expression2, expression3. . . ., expressionN)
FROM table_name;

Expression1, expression2, expression3 … expressionN are expressions evaluated by the least function.

  • If the data types of the expressions are different then all the expressions are converted to expression1 data type.
  • In character based comparison one character is considered lower or smaller than another if it has a lower character set.
  • If an expression is NULL in the LEAST function then NULL will be returned as least value.

Example 1:

SELECT LEAST(3,6,12,3)
FROM DUAL;

Will return “3”


Example 2:

SELECT LEAST('3','6','12','3')
FROM DUAL;

Will return “12”


Example 3:

SELECT LEAST('apples', 'grapes', 'bananas')
FROM DUAL;

Will return “apples”


Filed Under: function Tagged With: how to use least function in oracle database query, how to use least function in oracle plsql, how to use least function in oracle sql, least function in oracle plsql, least function in oracle sql, LEASTPLSQL, syntax and example of least function in oracle database query, syntax and example of least function in oracle plsql, syntax and example of least function in oracle sql, using least function in oracle database query, using least function in oracle plsql, using least function in oracle sql

Copyright © 2025 · Parallax Pro on Genesis Framework · WordPress · Log in