Domanda

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..??

È stato utile?

Soluzione

Just change order (Decode should be within select):

select Decode(country_id, 
              'IT', 'Italy',
              'JP', 'Japan', 
              'US', 'United States', 
              country_id)
  from XYZ
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top