Re: sqlplus "case when" statement

From: Klaus Zeuch <KZeuch_at_hotmail.com>
Date: Tue, 19 Sep 2000 21:37:34 +0200
Message-ID: <8q8f9s$jhq$13$1_at_news.t-online.com>


CASE was introduced with 8.1.6:

Connected to:
Oracle8i Enterprise Edition Release 8.1.6.1.0 - Production With the Partitioning option
JServer Release 8.1.6.0.0 - Production

SQL> SELECT AVG(CASE when e.sal > 2000 THEN e.sal ELSE 2000 end) FROM emp e;

AVG(CASEWHENE.SAL>2000THENE.SALELSE2000END)


                                 2519.64286

SQL> "TurkBear" <johng_at_mm.com> schrieb im Newsbeitrag news:39c78a25.428434265_at_news.news-ituk.to...
>
> There is no true CASE statement in SqlPlus, but to do what you want you
 can use:
>
> sum(decode(auth_type_code,'0210',amount_1,0)) where
> resp_code in ('00','11')
>
>
> "SDG" <simong_at_explor.co.uk> wrote:
>
> >Hello,
> >
> >Could anybody explain or provide information on how the case statement
 works
> >when writting sqplus.
> >
> >eg.
> >
> >sum(case when resp_code in ('00','01') then
> >decode(auth_type_code,'0210',amount_1,0) else 0 end )
> >
> >Thanks in anticipation.
> >
> >
>
>
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
Received on Tue Sep 19 2000 - 21:37:34 CEST

Original text of this message