Re: Oracle CASE

From: Mtek <mtek_at_mtekusa.com>
Date: Tue, 24 Feb 2009 06:07:54 -0800 (PST)
Message-ID: <705cab1a-8de4-4370-af00-2c0bd23f4dfe_at_m42g2000yqb.googlegroups.com>


[Quoted] 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...... Received on Tue Feb 24 2009 - 15:07:54 CET

Original text of this message