ORA-00933:SQL命令未正确结束ORACLE

时间:2013-09-19 12:24:18

标签: sql oracle

select  
  (
    (select Count(country_isoname) from games.country where country_olympic_code is null)
    /
    (select Count(*) from games.country)
  ) * 100 as 'Percentage'
from 
  games.country;

我目前正在尝试获取百分比,但收到错误,语法看起来正确我认为? 请帮忙!

2 个答案:

答案 0 :(得分:3)

'Percentage'是一个字符串文字。对象(列)名称用双引号括起来。

因此,您需要使用"Percentage"而不是'Percentage'

答案 1 :(得分:1)

尝试使用此

select (t1.specific_count/t2.all_count)*100 from 
(select count(country_isoname) as specific_count from country    
where country_olympic_code is null) t1, 
(select count(*) as all_count from country) t2;