Home » SQL & PL/SQL » SQL & PL/SQL » Does "Case when" can use at where clause
Does "Case when" can use at where clause [message #197318] Tue, 10 October 2006 23:50 Go to next message
Richard White
Messages: 3
Registered: December 2002
Junior Member
So as :

select * from mytable
where fld1 > 50
and case fld2
when 'a' then (fld3 is null or fld3 = '')
when 'b' then (fld3 is >12 or fld3 < -5)
and case fld4 = '1';

Re: Does "Case when" can use at where clause [message #197350 is a reply to message #197318] Wed, 11 October 2006 00:53 Go to previous message
Messages: 7062
Registered: December 2001
Senior Member
Yes you can use CASE in a where clause but not the way you did. CASE will evaluate an expression and return a value. It will not conditionally execute/evaluate additional criteria. Why don't you fire up SQL*Plus and find out? Moved to Newbies.

Previous Topic: Please Help Me
Next Topic: how convert colum into row
Goto Forum:

Current Time: Thu Aug 17 20:15:20 CDT 2017

Total time taken to generate the page: 0.11890 seconds