tech on the net
Home About Us Feedback Site Map

Microsoft

Access Excel Word

Database

SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker

Language

C Language

More

ASCII Table Linux UNIX Java Clipart Joke of the Moment
Share this page:

Oracle/PLSQL: GREATEST Function

Learn how to use the Oracle/PLSQL GREATEST function with syntax and examples.

Description

The Oracle/PLSQL GREATEST function returns the greatest value in a list of expressions.

Syntax

The syntax for the Oracle/PLSQL GREATEST function is:

GREATEST( expr1, expr2, ... expr_n )

Parameters or Arguments

expr1, expr2, . expr_n are expressions that are evaluated by the GREATEST function.

Note

If the datatypes of the expressions are different, all expressions will be converted to whatever datatype expr1 is.

If the comparison is based on a character comparison, one character is considered greater than another if it has a higher character set value.

Applies To

The GREATEST function can be used in the following versions of Oracle/PLSQL:

  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let's look at some Oracle GREATEST function examples and explore how to use the GREATEST function in Oracle/PLSQL.

For example:

GREATEST(2, 5, 12, 3) would return 12
GREATEST('2', '5', '12', '3') would return '5'
GREATEST('apples', 'oranges', 'bananas') would return 'oranges'
GREATEST('apples', 'applis', 'applas') would return 'applis'