SQL Tutorial SQL Advanced SQL Database SQL References

Oracle CURRENT_DATE Function



The Oracle (PL/SQL) CURRENT_DATE function returns the current date in the time zone of the current SQL session, in a value in the Gregorian calendar of datatype DATE.

Syntax

CURRENT_DATE

Parameters

No parameter is required.

Return Value

Returns the current date in the time zone of the current SQL session.

Example 1:

The example below shows the usage of CURRENT_DATE function.

CURRENT_DATE
Result: '26-DEC-2021'

CURRENT_DATE + 4
Result: '30-DEC-2021'

Example 2:

The example below illustrates that CURRENT_DATE is sensitive to the session time zone:

ALTER SESSION SET TIME_ZONE = '-5:0';
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;

Result: 
SESSIONTIMEZONE CURRENT_DATE
--------------- --------------------
-05:00          29-MAY-2000 13:14:03


ALTER SESSION SET TIME_ZONE = '-8:0';
SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;

Result: 
SESSIONTIMEZONE CURRENT_DATE
--------------- --------------------
-08:00          29-MAY-2000 10:14:33

Example 3:

Consider a database table called Employee with the following records:

EmpIDNameAgeDate_of_Joining
1John2525-MAY-2018
2Marry2415-OCT-2018
3Jo2709-JUN-2019
4Kim3021-SEP-2019
5Ramesh2825-OCT-2019

To insert a new record in this table, the following statement can be used.

INSERT INTO Employee 
VALUES (6, 'Suresh', 28, CURRENT_DATE);

-- see the result
SELECT * FROM Employee;

This will produce a result similar to:

EmpIDNameAgeDate_of_Joining
1John2525-MAY-2018
2Marry2415-OCT-2018
3Jo2709-JUN-2019
4Kim3021-SEP-2019
5Ramesh2825-OCT-2019
6Suresh2826-DEC-2021

❮ Oracle Functions