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: SQL server 7 equivalent code in Oracle?

Re: SQL server 7 equivalent code in Oracle?

From: Mary <mdellamalva_at_cetec.com>
Date: 2000/06/12
Message-ID: <8i3vkf$n50@chronicle.concentric.net>#1/1

Hello SP,

You want to use DECODE:

SELECT d.departmentid,

dept=DECODE(p.departmentID,p.departmentID<100,'Video',DECODE(p.departmentID, p.departmentID<200
,'CD-ROM',DECODE(p.departmentID,p.departmentID<300,'Book','DVD'))) from product p, department d

In a Nutshell it is: decode(<CASE>,<WHEN>,<THEN>,<ELSE>)

Hope this helps

Mary
mdellamalva_at_cetec.com

SP <spant1_at_aol.com> wrote in message
news:MVe15.1169$Qf6.46762_at_nuq-read.news.verio.net...
> I've this SQL code inside a PL/SQL body. But this is in SQL server 7.
 Can
> anyone suggest eqivalent code in Oracle.
> SELECT d.departmentid,
> 'dept'=CASE
> WHEN p.departmentID<100
> THEN 'Video'
> WHEN p.departmentID<200
> THEN 'CD-ROM'
> WHEN p.departmentID<300
> THEN 'Book'
> ELSE 'DVD'
> END
> from product p, department d
> where d.prodID = p.prodID
> order by dept desc
>
> Thanks,
> SP
>
>
Received on Mon Jun 12 2000 - 00:00:00 CDT

Original text of this message

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