Example Analysis of optimized date Operation in Oracle query
Editor to share with you the example analysis of Oracle query optimization date operation, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Add or subtract days, months and years
In Oracle, the date type can directly add or subtract the number of days, while the addition and subtraction of months use the add_months function.
Select a.hiredate hire date, a.hiredate + 5 plus 5 days, a.hiredate-5 minus 5 days, add_months (hiredate, 5) plus 5 months, add_months (hiredate,-5) minus 5 months, add_months (hiredate, 5 * 12) plus 5 years, add_months (hiredate,-5 * 12) minus 5 years from emp a where rownum