SELECT ACCOUNT_NAME, BILLING_ADDRESS,
DECODE(COUNTRY_CODE, 'US', 'United States', 'VN', 'Vietnam', 'Undefined')
FROM ACCOUNT;
Explanation:
IF COUNTRY_CODE = 'US' THEN Return 'United States'
ELSE IF COUNTRY_CODE = 'VN' THEN Return 'Vietnam'
ELSE Return 'Undefined
SQL Server:
CASE COUNTRY_CODE WHEN 'US' THEN 'United States'
WHEN 'VN' THEN 'Vietnam'
ELSE 'Undefined'
END;
Friday, April 10, 2009
DECODE
at 12:15 AM
Labels: Oracle, Oracle Query, PL/SQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment