eric mbiada
eric mbiada

Reputation: 3

I am having the error when trying to convert the field character to Uppercase using select case

I am having the error below when trying to convert the field character to Uppercase when the length of the country name is greater than the length of the currency name.

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

This is the SQL statement I used:

 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;

Upvotes: 0

Views: 67

Answers (3)

user359040
user359040

Reputation:

Try adding a comma after the first currencyname, and removing the brackets after the case keyword:

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;

Upvotes: 2

Im not familiar with oracle, but the error seems to specify a different issue.

Could it be that you just forgot to put an "," after currencyname?

Upvotes: 0

Jody
Jody

Reputation: 8301

You're missing a comma after currency.currencyname

Upvotes: 1

Related Questions