Home » Developer & Programmer » Reports & Discoverer » decode a numeric value to string in report
decode a numeric value to string in report [message #248493] Fri, 29 June 2007 03:39 Go to next message
cyantiah
Messages: 1
Registered: June 2007
Location: Malaysia
Junior Member

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
Littlefoot
Messages: 21813
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
Previous Topic: Problem While Printing Report
Next Topic: Printing Problem - Froms & Report 10g
Goto Forum:
  


Current Time: Fri Jul 05 05:55:24 CDT 2024