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!

Case statement within where clause

reachmeabcJan 21 2010 — edited Jan 21 2010
How can i write a case statement within Where clause of SQL statement.
Ex:
If sysdate is less than Dec 31 of 2009 then run the query for 2009 else run the query for 2010.

belwo query is not working. Please let me know how can i write a case statement within where clause.

Select * from table
where
Case
when to_char(sysdate,'yyyymmdd')<=20091231 then tax_year=2009
else tax_year=2010
End
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 18 2010
Added on Jan 21 2010
7 comments
28,477 views