Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Data Types
 

Returning a point just before a specific midnight with TRUNC

SQL> SQL> create or replace function f_getMidnight_dt (i_date_dt DATE) return date is   2  begin   3      return trunc(i_date_dt)+1-1/(24*60*60);   4  end;   5  / Function created. SQL> SQL> select f_getMidnight_dt(sysdate) from dual; F_GETMIDN --------- 10-JUN-07