错误(ORA-00923:在预期的位置找不到FROM关键字)

时间:2013-09-16 14:34:02

标签: sql oracle

    select 
      country_olympic_name, 
      SUM(part_gold) as 'Number of Gold Medals'
    From
      games.country,
      games.participation
   where
      participation.country_isocode = country.country_isocode
   group by
      country_olympic_name;

我一直收到错误ORA-00923:FROM关键字未找到预期位置且不知道原因,请帮助

5 个答案:

答案 0 :(得分:34)

标识符需要引用双引号(")。单引号(')表示字符(不是“名称”)。

因此你需要使用:

SUM(part_gold) as "Number of Gold Medals"

手册中的更多细节:

答案 1 :(得分:0)

您可以尝试这样做: -

select 
  country_olympic_name, 
  SUM(part_gold) as "Number of Gold Medals"
From
  games.country,
  games.participation
where
  participation.country_isocode = country.country_isocode
group by
  country_olympic_name;

答案 2 :(得分:0)

试试这个......

SELECT
      COUNTRY_OLYMPIC_NAME,
      SUM ( PART_GOLD ) AS NUMBER_OF_GOLD_MEDALS
FROM
      GAMES.COUNTRY,
      GAMES.PARTICIPATION
WHERE
      PARTICIPATION.COUNTRY_ISOCODE = COUNTRY.COUNTRY_ISOCODE
GROUP BY
      COUNTRY_OLYMPIC_NAME;

答案 3 :(得分:0)

就我而言,我有这个查询

SELECT BANK_NAME
DECODE (SWIFT_CODE, 'BRDEROBU', 'BRD',
                   'NO RESULT') RESULT
FROM BANK_GAR;

如您所见,SELECT BANK_NAME行之后,我没有分号

正确的查询是:

SELECT BANK_NAME,
DECODE (SWIFT_CODE, 'BRDEROBU', 'BRD',
                   'NO RESULT') RESULT
FROM BANK_GAR;

答案 4 :(得分:0)

检查保留字。这是我的问题。不管出于什么原因,使用“大小”作为列别名都会导致oracle吐出确切的错误,这让我挠了一下头。

select 1 size, 1 id from dual