|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Formatting SQL output strings
Hi,
I'm trying to find a way of replacing the strings (varchar) returned by an SQL query with other strings. For example, if my query returns a column containing 'USA', how do I display this as 'United States' in the query results without changing what's in the database (i.e. avoid using update or replace)?? Thanks for any help |
|
#2
|
|||
|
|||
|
Oracle has a decode function:
SELECT decode(country_code, 'USA', 'United States', 'UK', 'Great Britain', 'DE', 'Germany', counry_code) FROM table Other alternative is to create a table with the display values, and join the tables in the query. |
|
#3
|
|||
|
|||
|
That's great, thanks a lot
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Formatting SQL output strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|