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 -> Re: DECODE question

Re: DECODE question

From: Scott Mattes <ScottMattes_at_yahoo.com>
Date: Fri, 06 Jul 2001 21:41:09 GMT
Message-ID: <Vfq17.15$zY2.11148@news2.news.adelphia.net>

What is the error that you are getting? According to my quick scan of the online docs the 3rd and 4th args can be strings, numbers or functions (I didn't see one example of using a field, but I think I know that I have done it).

"Jason" <jason_at_solid.freeserve.co.uk> wrote in message news:9i4vcp$u2o$1_at_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 - 16:41:09 CDT

Original text of this message

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