SELECT * FROM OMS_POHEADM
WHERE To_Date(DATE_ENTERED,'dd/MM/yy') =
if (To_Date('01/05/02', 'dd/MM/yy') = To_date('01/01/70','dd/MM/yy')) then
To_Date('01/05/02', 'dd/MM/yy')
elsif (To_Date('01/05/03', 'dd/MM/yy') = To_date('01/01/70','dd/MM/yy'))
To_Date('01/05/03', 'dd/MM/yy')
else To_date(sysdate,'dd/MM/yy')-30
end if
Because I always get "Missing right parenthesis" error msg.
As Bimalaggarwal said, you can't use if/then/else in sql. Use decode.
But having said that, why are you checking against this condition?
if (To_Date('01/05/02', 'dd/MM/yy') = To_date('01/01/70','dd/MM/yy') ...
That criteria is never going to be satisfied, because you're pitching two completely different hardcoded dates against each other, and checking if they're ever going to be the same date - which of course, they never will be.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.