What is the function that determines the maximum value in a series?

by Hello   Last Updated September 05, 2018 20:06 PM

Say I have a table with columns C and D (among others but these are the relevant ones) with the date type.

I am instructed to update the values in C to be 90 days before its corresponding value in D, or the current date, whichever is later.

I'm given the hint that it "will be useful to search for the Oracle function that determines the maximum value in a series. Hint: it is not max(), which is an aggregate function!"

I have no idea what this function is and would appreciate any help!

Answers 1

The function is called GREATEST()

GREATEST returns the greatest of a list of one or more expressions. Oracle Database uses the first expr to determine the return type. If the first expr is numeric, then Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data type before the comparison, and returns that data type. If the first expr is not numeric, then each expr after the first is implicitly converted to the data type of the first expr before the comparison.

September 05, 2018 19:52 PM

Related Questions

How do I drop the TIME portion from DATEADD?

Updated August 10, 2015 19:02 PM

Update data not run

Updated April 16, 2019 14:06 PM

Column Datatype Conversion Question

Updated April 27, 2015 23:02 PM

Date as x-axis: How to multiply and divide dates?

Updated November 30, 2017 13:06 PM

Oracle 11.2 index on VARCHAR vs index on DATE

Updated February 23, 2017 11:06 AM