I am using a Decode function something like this:

DECODE ((select country_id from XYZ), 
                    'IT', 'Italy',
                    'JP', 'Japan', 
                    'US', 'United States', country_id);

I want it to be behave in such a manner that If country_id is one of these three then it should decode the Id otherwise the default should display the country_id as it is.

Is this possible..??

有帮助吗?

解决方案

Just change order (Decode should be within select):

select Decode(country_id, 
              'IT', 'Italy',
              'JP', 'Japan', 
              'US', 'United States', 
              country_id)
  from XYZ
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top