SQL GREATEST scalar function in DB2 for i SQL

SQL GREATEST scalar function in DB2 for i SQL
SQL GREATEST scalar function in DB2 for i SQL, sql, sql db2, ibmi, sql function, scalar function
SQL GREATEST scalar function in DB2 for i SQL

GREATEST

The GREATEST function returns the maximum value in a set of values.

Syntax

GREATEST(arg1, arg2, arg3, ...)

Example #1:

SELECT GREATEST(3,2,4,9,7,8) FROM SYSIBM.SYSDUMMY1
     GREATEST
            9

Example #2:

SELECT GREATEST(3,2,4,9,7,8,10.1, 11) FROM SYSIBM.SYSDUMMY1
        GREATEST
            11.0

Example #3:

SELECT GREATEST('a', 'b', 'c') FROM SYSIBM.SYSDUMMY1
GREATEST
   c    

Example #4:

SELECT GREATEST('a', 'b', 'A') FROM SYSIBM.SYSDUMMY1
GREATEST
   A    

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain