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: renaming data

Re: renaming data

From: Matt Brennan <mbrennan_at_gers.net>
Date: Tue, 06 Oct 1998 21:48:36 GMT
Message-ID: <01bdf172$f9798b60$049a0580@mcb>


Can you use decode?:

select decode(mycolumn,'F','First','L','Last,mycolumn) "newcolumnname"f from mytable;

"Decode" is a function that does an if, then, if, then, if, then,..., else on something.

Above, it means if the value is 'F', then return 'First', if it's 'L', then return 'Last', otherwise just return the value for mycolumn (for anything that isn't 'F' or 'L').
--
Matt Brennan
SQL*Tools Specialist
GERS Retail Systems
9725-C Scranton Road
San Diego, California 92121
1-800-854-2263
mbrennan_at_gers.com
(Original email address is spam-blocked...please change 'net' to 'com'.)

Kyle Nesbitt <greater_at_justviewit.com> wrote in article <361A725B.6946D097_at_justviewit.com>...
> I use Oracle 8, With Platinum's Forest and Trees as a development tool.
> I am attempting to replace a columns results with an alias identifier.
> (example: if I get back the letter F in my column then I would like to
> replace them all with the word FIRST and L with the word LAST and so on)
> there will be many instances of L's and F's along with about 10 other
> letter Identifiers.
> In Forest and Trees I can use an IFVAL
> function in the Select statement. But, if there are more than one
> grouup of letters it creates a new column for each. Then I have to go
> through a bunch of hastle to joint all data back into a single colums..
> Any suggestions.. Maybe Oracle could return what I need through the SQL
> statement.
>
> Thanks
>
>
Received on Tue Oct 06 1998 - 16:48:36 CDT

Original text of this message

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