Oracle CURRENT_DATE Function
Oracle CURRENT_DATE is a built-in function that returns the current date in the current session time zone as a value of the DATE data type in the Gregorian calendar.
Oracle CURRENT_DATE Syntax
Here is the syntax of the Oracle CURRENT_DATE function:
CURRENT_DATE
Note that you cannot use parentheses after the function name.
Parameters
The Oracle CURRENT_DATE function does not require any parameters.
Return Value
The Oracle CURRENT_DATE function returns the current date in the current session time zone as a value of the DATE data type in the Gregorian calendar.
Oracle CURRENT_DATE Examples
Here are some examples that demonstrate the usage of the Oracle CURRENT_DATE function.
Basic Usage
To get the current date, use the following statement:
ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD';
SELECT
CURRENT_DATE
FROM dual;
Output:
CURRENT_DATE
_______________
2023-02-11Here, we use the ALTER SESSION statement to change the date format of the current session to YYYY-MM-DD.
Current Time
You can display the current date and time by modifying the date format of the current session.
First, modify the date format of the current session to display the date and time in the format YYYY-MM-DD HH24:MI:SS:
ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';
Then, run the CURRENT_DATE function:
SELECT
CURRENT_DATE
FROM dual;
Output:
CURRENT_DATE
______________________
2023-02-11 14:06:54Conclusion
Oracle CURRENT_DATE is a built-in function that returns the current date in the current session time zone as a value of the DATE data type in the Gregorian calendar.