# GREATEST function in Oracle

GREATEST is one of the vital Numeric/Math functions of Oracle. It is used to get the greatest value from a list of expressions. The GREATEST function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

```GREATEST( expr_1, expr_2, ... expr_n )
```

Parameters:
expr_1, expr_2, … expr_n: It is used to specify the expression to be evaluated.

Example 1:

```GREATEST( 5, 6, 9, 10 )
```

Output:

```10
```

Explanation:
The greatest value is 10 in the above expression.

Example 2:

```GREATEST( ‘5’, ‘6’, ‘9’, ‘10’ )
```

Output:

``` ‘9’
```

Explanation:
Since it is a character comparison, hence ‘9’ here is Greatest since it has a higher character set value.

Example 3:

```GREATEST( ‘ant’, ‘boy’, ‘elephant’, ‘zebra’ )
```

Output:

``` ‘zebra’
```

Explanation:
Since it is a character comparison, hence ‘zebra’ here is Greatest since it has a higher character set value.

Example 4:

```GREATEST( ‘ant’, ‘any’, ‘ani’, ‘ana’ )
```

Output:

``` ‘any’
```

Explanation:
Since it is a character comparison, hence ‘any’ here is Greatest since it has a higher character set value.