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

Home -> Community -> Usenet -> c.d.o.tools -> DECODE question

DECODE question

From: Jason <jason_at_solid.freeserve.co.uk>
Date: Fri, 6 Jul 2001 19:16:47 +0100
Message-ID: <9i4vcp$u2o$1@newsg4.svr.pol.co.uk>

Having been used to Access and SQLServer, I am hitting a couple of problems translating some SQL code to Oracle. Here's one that I can't seem to work out.

Consider the following Access code. Basically, it looks at a field called RotaShift. If this is filled in, that is the field that is used, otherwise the field AltShift is used.

IIf ( RotaShift IS NULL, AltShift, RotaShift) AS Shift

Now in trying to translate this to Oracle, I have come up with :-

DECODE (RotaShift, Null, AltShift, RotaShift) AS Shift

However, this doesn't seem to work. From what I can see, the 3rd and 4th arguments can only be numeric values, not fields. Is there a workaround for this.

TIA Jason. Received on Fri Jul 06 2001 - 13:16:47 CDT

Original text of this message

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