Date Functions: Greatest

Description: Returns the latest date value.

LEAST(<date>, <date>, <date>, ...)
 
CREATE TABLE t (
datecol1 DATE,
datecol2 DATE,
datecol3 DATE)
PCTFREE 0
TABLESPACE data_sml;
 
INSERT INTO t VALUES (SYSDATE+23, SYSDATE-10, SYSDATE-24);
INSERT INTO t VALUES (SYSDATE-15, SYSDATE, SYSDATE+15);
INSERT INTO t VALUES (SYSDATE-7, SYSDATE-18, SYSDATE-9);
COMMIT;
 
SELECT * FROM t;
 
SELECT GREATEST(datecol1, datecol2, datecol3)
FROM t;
 
LAST_DAY
Returns The LAST DATE OF A MONTH     LAST_DAY(<date>)
SELECT * FROM t;
 
SELECT LAST_DAY(datecol1) FROM t;

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.