Get the Current Date for PL/SQL

Share on facebook
Share on twitter
Share on linkedin
Share on reddit

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

As the Senior Project manager, Armand is one of the rare kind of developers that can do both design and programming with equal skill. This, coupled with a solid background and many years of experience, enables him to see the big picture and plan for the small details.

3 Responses

Comments are closed.