decode a numeric value to string in report [message #248493] |
Fri, 29 June 2007 03:39 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cyantiah
Messages: 1 Registered: June 2007 Location: Malaysia
|
Junior Member |
![angelcya07](/forum/theme/orafaq/images/yahoo.png)
|
|
hi,
I'm a newbie in report. Let say I have a table Address, and one of the column on Address table is AddressType. The column data type is number. However when I want to generate the report of Address table, the data in AddressType column have to be decoded.
example,
1- Corresponding address
2- Office address
3- home address...etc..
.
.
.
how do I do this?
[Updated on: Fri, 29 June 2007 03:40] Report message to a moderator
|
|
|
Re: decode a numeric value to string in report [message #248517 is a reply to message #248493] |
Fri, 29 June 2007 05:24 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Model you've described is not enough. Where do you take corresponding / office / home addresses from? Because, I doubt your intention is to get exactly the same output as you've posted it. However, if it really was the case, use DECODE or CASE (such as in this example):WITH test AS
(SELECT LEVEL address_type
FROM dual
CONNECT BY LEVEL <=3
)
SELECT DECODE(address_type, 1, 'Corresponding address',
2, 'Office address',
3, 'Home address'
) result
FROM test;
RESULT
---------------------
Corresponding address
Office address
Home address
|
|
|