Re: CASE statement in WHERE Clause - Weird one

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Thu, 22 May 2014 22:44:12 +0200
Message-ID: <bu75stF2tmfU1_at_mid.individual.net>


On 22.05.2014 09:21, Kay Kanekowski wrote:
> Hi,
> what about this ?
> SELECT ROUND(AVG(pct_total),2)
> INTO v_average
> FROM pfp_to_buyer_agg
> WHERE registration_period >= '01-OCT-2012'
> AND ( ( v_period <> 1 and period = v_period)
> or ( v_period = 1 and period in (0,1)
> ) ;
>
> But as Geoff said, it's clearer to do the case outside the selects

Why even bother to use CASE if there are only two alternatives? A good old if then else would do as well. After all this is about PL/SQL.

Kind regards

        robert Received on Thu May 22 2014 - 22:44:12 CEST

Original text of this message