Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to find rows within the last 10 years without using SYSDATE - (10*365)

SebaVastaJun 8 2023 — edited Jun 8 2023
We want to find the crimes committed by an individual within last 10 years.
Is there a more elegant way to do this than below method (in 11g R2)?
SELECT * 
FROM txn_table 
WHERE date_committed > (SYSDATE - (10*365));

PS: Should we use TRUNC on both dates above???
This post has been answered by Sanjeev Chauhan on Jun 8 2023
Jump to Answer
Comments
Post Details
Added on Jun 8 2023
8 comments
2,096 views