Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: doing data conversions
Hi,
that's a nice trick! I don't think I would have come up with that! Though I must say that I prefer to use a stored function as described in my posting. It is more generic and flexible, and errors are less likely to occur.
Regards,
Patrick Sinke
Cap Gemini Ernst & Young, sector Financial Services
John Russell <johnrussell10_at_home.com> schreef in berichtnieuws
67spftom6dc1lrupkb7g6ovc6bpa7j19f6_at_4ax.com...
> On Thu, 10 May 2001 15:14:16 +0200, "Patrick Sinke"
> <patrick.sinke_at_capgemini.nl> wrote:
> >It's gonna be a large piece of code, but you can do it with Decode!
> >
> >select decode( 'AL', 'alabama'
> > , 'CA', 'California'
> > , ...... -- and so on
> > , 'Unknown' -- value if none of the above match
> > )
> >from table
>
> If you have too many choices in DECODE, it errors out. A way around
> this is to make the final default value NULL and use NVL to call a
> second DECODE if the first one didn't have any matches. (And a third
> if you really have a lot of values.)
>
> Not that I have ever done this! :-)
>
> John
> --
> Got an Oracle database question?
> Try the search engine for the database docs at:
> http://tahiti.oracle.com/
Received on Mon May 14 2001 - 03:21:52 CDT