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 parameter to determine the return type. If the remaining parameters have different data types from that of the first expr parameter, OceanBase Database implicitly converts each parameter after the first expr parameter to the data type of the first expr parameter.
If the first
exprparameter is of theNUMBER,FLOAT,BINARY_FLOAT, orBINARY_DOUBLEdata type, the return type is the same as the data type of the firstexprparameter.If the first
exprparameter is of theCHAR,VARCHAR2, orCLOBdata type, the return type isVARCHAR2.If the first
exprparameter is 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