Friday, January 11, 2013

Current_Date function


In Oracle/PLSQL, the current_date function returns the current date in the time zone of the current SQL session as set by the ALTER SESSION command.

Syntax

The syntax for the current_date function is:
current_date

Applies To

  • Oracle 11g, Oracle 10g, Oracle 9i

For Example

If the following ALTER SESSION command was issued:
ALTER SESSION SET TIME_ZONE = '-7:0';
And then the following SQL statement was executed:
select current_date
from dual;
You might get the following result:
9/10/2005 10:58:24 PM
You then modified the session time zone with the following ALTER SESSION command:
ALTER SESSION SET TIME_ZONE = '-2:0';
And then the following SQL statement was executed:
select current_date
from dual;
You would now get the following result:
9/11/2005 3:58:24 AM
The session time zone value has changed from -7:0 to -2:0, causing the current_date function to return the current date as a value 5 hours ahead.