Re: Oracle CASE

From: Michael Austin <maustin_at_firstdbasource.com>
Date: Tue, 24 Feb 2009 19:28:38 -0600
Message-ID: <l71pl.8101$%54.4928_at_nlpi070.nbdc.sbc.com>


Mtek wrote:

> On Feb 23, 3:35 pm, Gints Plivna <gints.pli..._at_gmail.com> wrote:

>> On 23 Febr., 20:30, Mtek <m..._at_mtekusa.com> wrote:> Can you have multiple conditions in the WHEN clause of a CASE
>>> statement?
>>> CASE v_subproduct_id
>>> WHEN 197 OR 95 THEN
>> either
>>
>> case v
>> when 197 then 'x'
>> when 95 then 'x'
>> end
>>
>> Or
>> case when v = 197 or v = 95 then 'x'
>> end
>>
>> Gints Plivnahttp://www.gplivna.eu
> 
> Well, both the 197 & 95 will execute the same code, there is no reason
> to code them separately......so, I guess #2 is the way to go.  I just
> hate having to re-state the variable I am testing over and over again
> in each condition......
> 

Then I would (and so should you) tend to question your database design as to why you have to do this... It may be perfectly valid, all I am stating is that I would have to reevaluate the design.... Received on Wed Feb 25 2009 - 02:28:38 CET

Original text of this message