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

Home -> Community -> Usenet -> c.d.o.misc -> Re: MSSQL Case equiv in Oracle (8.1.7.2.0)

Re: MSSQL Case equiv in Oracle (8.1.7.2.0)

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Tue, 20 Jan 2004 18:11:43 -0800
Message-ID: <1074651036.31009@yasure>


James wrote:

> Thanks Daniel,
>
> The code was closer than i expected.
>
> SELECT priority =
> CASE
> WHEN (priority = '04-Medium' AND severity = '99') THEN 'URGENT'
> ELSE priority
> END
> FROM table_case
>
> Works a treat!

Glad it it works for you but it sure doesn't work for me the 9.2.0.4.

SQL> create table table_case (

   2 priority VARCHAR2(20),
   3 severity VARCHAR2(2));

Table created.

SQL> SELECT priority =

   2 CASE

   3      WHEN (priority = '04-Medium' AND severity = '99') THEN 'URGENT'
   4      ELSE priority

   5 END
   6 FROM table_case;
SELECT priority =
                 *

ERROR at line 1:
ORA-00923: FROM keyword not found where expected

What does work is:

SQL> SELECT
   2 CASE

   3      WHEN (priority = '04-Medium' AND severity = '99') THEN 'URGENT'
   4      ELSE priority

   5 END
   6* FROM table_case
SQL> / no rows selected

SQL> Which is what I sent you.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue Jan 20 2004 - 20:11:43 CST

Original text of this message

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