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.

Armand Niculescu

Armand Niculescu

Senior Full-stack developer and graphic designer with over 25 years of experience, Armand took on many challenges, from coding to project management and marketing.

3 Responses

Comments are closed.