How to add 2 dates in Oracle sp? [closed]

我是研究僧i 提交于 2019-12-13 09:26:26

问题


How can we add two dates in oracle? For example in sql we can do this, " date_1 + date_2 " how can we achieve the same thing in Oracle


回答1:


Adding two dates together would be meaningless but you can add an interval to a timestamp. For example, to add 1 year and 10 months to a timestamp:

SELECT SYSDATE + INTERVAL '1-10' YEAR TO MONTH FROM DUAL;

You can also add days to a DATE column using simple arithmetics. For example, you can add 45 days to the current date using:

SELECT CURRENT_DATE + 45 FROM DUAL;


来源:https://stackoverflow.com/questions/12954947/how-to-add-2-dates-in-oracle-sp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!