Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: doing data conversions

Re: doing data conversions

From: John Russell <johnrussell10_at_home.com>
Date: Sat, 12 May 2001 08:17:38 GMT
Message-ID: <67spftom6dc1lrupkb7g6ovc6bpa7j19f6@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 Sat May 12 2001 - 03:17:38 CDT

Original text of this message

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