Table of Contents

Search

  1. Preface
  2. Function reference
  3. Constants
  4. Operators
  5. Dates
  6. Functions
  7. System variables
  8. Datatype reference

Function Reference

Function Reference

GREATEST

GREATEST

Returns the greatest value from a list of input values. Use this function to return the greatest string, date, or number. By default, the match is case sensitive.

Syntax

GREATEST(
value1
, [
value2
, ...,
valueN
,]
CaseFlag
)
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 numeric, all values use the highest precision possible. For example, if some values are Integer datatype and others are Double datatype,
Data Integration
converts the values to Double.
CaseFlag
Optional
Must be an integer. Determines whether the arguments in this function are case sensitive. You can enter any valid expression.
When
CaseFlag
is a number other than 0, the function is case sensitive.
When
CaseFlag
is a null value or 0, the function is not case sensitive.

Return Value

value1
if it is the greatest of the input values,
value2
if it is the greatest of the input values, and so on.
NULL if all the arguments are null.

Example

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

0 COMMENTS

We’d like to hear from you!