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:
EmpID | Name | Age | Date_of_Joining |
---|---|---|---|
1 | John | 25 | 25-MAY-2018 |
2 | Marry | 24 | 15-OCT-2018 |
3 | Jo | 27 | 09-JUN-2019 |
4 | Kim | 30 | 21-SEP-2019 |
5 | Ramesh | 28 | 25-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:
EmpID | Name | Age | Date_of_Joining |
---|---|---|---|
1 | John | 25 | 25-MAY-2018 |
2 | Marry | 24 | 15-OCT-2018 |
3 | Jo | 27 | 09-JUN-2019 |
4 | Kim | 30 | 21-SEP-2019 |
5 | Ramesh | 28 | 25-OCT-2019 |
6 | Suresh | 28 | 26-DEC-2021 |
❮ Oracle Functions