我尝试使用select case将字段字符转换为大写字母时出错

时间:2013-04-20 13:56:51

标签: sql oracle

当国家/地区名称的长度大于货币名称的长度时,我尝试将字段字符转换为大写字母时出现以下错误。

ORA-00923: FROM keyword not found where expected
00923. 00000 -  "FROM keyword not found where expected"

这是我使用的SQL语句:

 select 
 countryname.country, countryname.currencycode, currency.currencyname
 case(
 when length(countryname.country)> length (currency.currencyname) 
 then UCASE(countryname.country)
 else
 LCASE(countryname.country)
 )end     
 from  currency,countryname
 where currency.currencycode=COUNTRYNAME.currencycode;

3 个答案:

答案 0 :(得分:2)

尝试在第一个currencyname之后添加逗号,并删除case关键字后的括号:

select 
 countryname.country, countryname.currencycode, currency.currencyname,
 case
 when length(countryname.country)> length (currency.currencyname) 
 then UCASE(countryname.country)
 else
 LCASE(countryname.country)
 end     
 from  currency,countryname
 where currency.currencycode=COUNTRYNAME.currencycode;

答案 1 :(得分:1)

您在currency.currencyname

之后缺少逗号

答案 2 :(得分:0)

我不熟悉oracle,但错误似乎指出了另一个问题。

难道你只是忘了在货币名后加上“,”吗?