我有以下查询:
SELECT
FIRST_NAME AS "NAME",
CASE COUNTRY
WHEN "FR" THEN "FRANCE"
WHEN "USA" THEN "UNITED STATES"
WHEN "C RO" THEN NULL
ELSE COUNTRY
END AS "COUNTRY"
FROM RAWDATA
向前看似乎很困难,但出现以下错误:
ociexecute(): ORA-00904: "C RO": invalid identifier in path
我对oracle还是很陌生,所以可以帮助您。
答案 0 :(得分:3)
尝试一下。 oracle中的字符串文字用单引号引起来。双引号用于括起标识符(如表名和列名),但在您的示例中不需要。
SELECT
FIRST_NAME AS NAME,
CASE COUNTRY
WHEN 'FR' THEN 'FRANCE'
WHEN 'USA' THEN 'UNITED STATES'
WHEN 'C RO' THEN NULL
ELSE 'COUNTRY'
END AS COUNTRY
FROM RAWDATA