Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: doing data conversions
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 Sat May 12 2001 - 03:17:38 CDT