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

Re: question about DECODE

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Wed, 14 Aug 2002 22:54:22 GMT
Message-ID: <3D5ADF9A.D08E2670@exesolutions.com>


Martin Doherty wrote:

> begin
> select decode (PSEG.PSCDE || PSPLN.PLNFLAG
> ,'PLANY', 1
> , 0)
> into p_bill
> from ...
> where ...;
> exception
> when others then null;
> end;
>
> Cynic wrote:
>
> > I think DECODE is what I'm looking for, but I can't seem to figure out how
> > it works.
> >
> > Here's what I have... I have a field called P_BILL.
> > If PSEG.PSCDE = 'PLAN' and PSPLN.PLNFLAG = 'Y', then I need the P_BILL
> > field to be 1. Otherwise, 0.
> >
> > Any suggestions?? Or any good references for DECODE??
> >
> > Thanks

A tool far better suited to your request is CASE. In 8i you must wrap it in native dynamic SQL. In 9i you can use it directly.

Daniel Morgan Received on Wed Aug 14 2002 - 17:54:22 CDT

Original text of this message

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