Oracle CURRENT_DATE Function


/ Published in: SQL
Save to your folder(s)

A few examples of the Oracle CURRENT_DATE function.


Copy this code and paste it in your HTML
  1. --CURRENT_DATE
  2.  
  3. SELECT CURRENT_DATE, SYSDATE
  4. FROM dual;
  5.  
  6. SELECT TO_CHAR(CURRENT_DATE, 'DD-MON-YY HH:MI:SS') AS CDATE,
  7. TO_CHAR(SYSDATE, 'DD-MON-YY HH:MI:SS') AS SDATE
  8. FROM dual;
  9.  
  10.  
  11. SELECT CURRENT_DATE,
  12. TRUNC(CURRENT_DATE) AS trunc_today,
  13. TRUNC(CURRENT_DATE)-1 AS trunc_yesterday
  14. FROM dual;
  15.  
  16.  
  17. --Example 1
  18. SELECT CURRENT_DATE
  19. FROM dual;
  20.  
  21. --Example 2
  22. SELECT TO_CHAR(CURRENT_DATE, 'DD-MON-YY HH:MI:SS') AS CDATE
  23. FROM dual;

URL: http://www.databasestar.com/oracle-current_date/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.