Hi All,
I'm working on Informatica solution for increment logic. I need to extract data till last week's Thursday. No matter, when extraction process starts this week, it should have end date as last week's Thursday.
For example,Today is
7/16/2017 (Sunday) - End date should be 07/13/2017
7/17/2017 (Monday) - End date should be 07/13/2017
7/18/2017 (Tuesday) - End date should be 07/13/2017
7/19/2017 (Wednesday) - End date should be 07/13/2017
7/20/2017 (Thursday) - End date should be 07/13/2017
7/21/2017 (Friday) - End date should be 07/13/2017
7/22/2017 (Saturday) - End date should be 07/13/2017
I did some google,and took help of Oracle manual and came up with below SQL. It works fine till Wednesday (07/19/2017), but when current date becomes Thursday (07/20/2017), it returns 07/20/2017 instead of 07/13/2017.
SELECT trunc(SYS_DATE + 2, 'd') -3 from (
SELECT SYSDATE + 4 from dual )
Can someone please help me to find what I missed here....