📅  最后修改于: 2023-12-03 15:03:24.084000             🧑  作者: Mango
Oracle SYSDATE
is a function that returns the system date and time of the server where the database is installed. It is used to get the current date and time from the server which can be used in various SQL queries.
The syntax of the SYSDATE function is:
SELECT SYSDATE FROM dual;
Output:
| SYSDATE | |---------| | 23-JUN-21 12.13.15 AM |
SYSDATE can be used in various SQL queries such as:
SELECT SYSDATE FROM dual;
SELECT SYSDATE + 1 FROM dual; -- adds one day to the current date
SELECT SYSDATE - 1/24 FROM dual; -- subtracts one hour from the current time
SELECT * FROM orders WHERE order_date > SYSDATE-7; -- fetches orders placed in the last 7 days
In summary, SYSDATE
is a very useful function in Oracle SQL for fetching the current date and time, performing date and time arithmetic, and for date comparisons.