Purpose
LEAST() returns the minimum value in a list of one or more expressions.
Syntax
LEAST(expr [, expr ]...)
Parameters
expr is a list of one or more expressions. It can be of the NUMBER, FLOAT, BINARY_FLOAT, BINARY_DOUBLE, CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type.
Return type
OceanBase Database uses the first expr to determine the return type. If the remaining arguments have different data types from that of the first expr, OceanBase Database implicitly converts each argument after the first expr to the data type of the first expr.
If the first
expris of theNUMBER,FLOAT,BINARY_FLOAT, orBINARY_DOUBLEdata type, the return type is the same as the data type of the firstexpr.If the first
expris of theCHAR,VARCHAR2, orCLOBdata type, the return type isVARCHAR2.If the first
expris of theNCHARorNVARCHAR2data type, the return type isNVARCHAR2.
Examples
The following example compares the strings
AC,BB, andCand returns the string with the minimum value.obclient> SELECT LEAST('AC','BB','C') "MIN" FROM DUAL; +-----+ | MIN | +-----+ | AC | +-----+ 1 row in setThe following example compares the integer
1and the strings6and5.555and returns the minimum value.obclient> SELECT LEAST (1,'6','5.555') "MIN" FROM DUAL; +-----+ | MIN | +-----+ | 1 | +-----+ 1 row in set