Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Conditional Select statement

Re: Conditional Select statement

From: Marc Billiet <first.last_at_com.hydro.switch.this>
Date: Thu, 05 Apr 2001 05:35:36 GMT
Message-ID: <20010405.5353669@y1032960.hae.hydro.com>

In Oracle 8i, you can write:

select case

         when value = 'OK' then 'this is the correct value'
         when value = 'FAIL' then 'this is not the correct value'
         else 'unknown value'
        end

from yourtable

Marc

>>>>>>>>>>>>>>>>>> Oorspronkelijk bericht <<<<<<<<<<<<<<<<<<

Op 2001-04-04, 17:25:44, schreef "Jon" <jzuazoa_at_nexo.es> over het thema

Conditional Select statement:

> Hi,
 

> I would like to know if it is posible to add some conditional behaivou
r
to a
> select statement. I mean that if have a table that contains sometimes
 the
> 'OK' value and 'FAIL' for other rows so I could create a statement tha
t
when
> the row contains 'OK' it would print 'this is the correct value' and o
n
the
> other hand when it contains 'FAIL' it just prints 'this is not the

correct
> value'

> Thanks for you help
 

> PS. this task is accomplish in SYBASE using 'CASE WHEN...'
Received on Thu Apr 05 2001 - 00:35:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US