Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: DECODE question
Yes, you can. I'm pretty sure that any function can be nested within any other
function to N levels deep. You just have to be VERY careful to get all the
arguments and parentheses in the right places.
Cynic wrote:
> "Richard Kuhler" <noone_at_nowhere.com> wrote in message
> news:xymW8.81779$xy.27352213_at_twister.socal.rr.com...
> > I think that particular example is best expressed as:
> >
> > greatest(ddb_date, cdate(param_value))
> >
>
> Yeah, I guess I gave a pretty stupid example.
> ONE more question (I promise). Can I nest DECODES? (the reason I ask is that
> I have a need for it, and have tried it but it's not working - maybe just a
> typo)
>
> > Richard
> >
> > Cynic wrote:
> > >
> > > "Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote in message
> > > news:uijpaj3aper9e_at_corp.supernews.com...
> > > >
> > > > "Cynic" <ksd9_at_yahoo.com> wrote in message
> > > > news:uijjmmnp2c4810_at_corp.supernews.com...
> > > > > Does anyone know of a good location where I can find documentation
> on
> > > > > DECODE?
> > > > >
> > > > > I'm attempting to translate Access queries into Oracle views and
> need to
> > > > > find a replacement for Access' "IIf" statement. I'm hoping DECODE
> will
> > > be
> > > > > it, but I'm trying to find out how to replace the following:
> > > > > Select IIF(ord_amt > 1000, "Large", "Small")
> > > > >
> > > > >
> > > > >
> > > >
> > > > decode(sign(ord_amt - 1000),1,'Large','Small')
> > > > You can find information on decode in the sql reference manual, but I
> > > doubt
> > > > it will have this example, which requires some combining of functions.
> > > >
> > > > Hth
> > >
> > > Thanks! That works great for certain things. However, do you know how
> that
> > > would work in a situation of date data types?
> > > Example:
> > > IIf(ddb_date < CDATE(param_value), CDATE(param_value), ddb_date)
> > >
> > > Thanks, again.
> > >
> > > >
> > > > --
> > > > Sybrand Bakker
> > > > Senior Oracle DBA
> > > >
> > > > to reply remove '-verwijderdit' from my e-mail address
> > > >
> > > >
> > > >
> > > >
> >
![]() |
![]() |