Transformation Language Reference > Functions > LEAST
  

LEAST

Returns the smallest value from a list of input values. By default, the match is case sensitive.

Syntax

LEAST( value1, [value2, ..., valueN,] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
value
Required
Any datatype except Binary. Datatype must be compatible with other values. Value you want to compare against other values. You must enter at least one value argument.
If the value is Numeric, and other input values are of other numeric datatypes, all values use the highest precision possible. For example, if some values are of the Integer datatype and others are of the Double datatype, the Data Integration Service converts the values to Double.
CaseFlag
Optional
Must be an integer. Specify a value when the input value argument is a string value. Determines whether the arguments in this function are case sensitive. You can enter any valid transformation expression.
When CaseFlag is a number other than 0, the function is case sensitive.
When CaseFlag is 0, the function is not case sensitive.
Default is case sensitive.

Return Value

value1 if it is the smallest of the input values, value2 if it is the smallest of the input values, and so on.
NULL if any of the arguments is null.

Example

The following expression returns the smallest quantity of items ordered:
LEAST( QUANTITY1, QUANTITY2, QUANTITY3 )
QUANTITIY1
QUANTITY2
QUANTITY3
RETURN VALUE
150
756
27
27
NULL
5000
97
17
17
120
1724
965
120