Get the Current Date for PL/SQL

This is not really a post, just a small note on an item that can make you lose precious time hunting for…

To get the current date in a PL/SQL query in order to compare it with other fields or data from the Oracle database, do this:

select extract(year from sysdate)
from dual

This gets the current year; of course you can use day or month instead of year.

I know search engines find such small items faster than any documentations, so I can only hope this will be useful for someone.

3 replies

Comments are closed.