不存在ORA-00904:标识符错误无效

时间:2013-04-22 11:52:14

标签: sql oracle11g

当我执行以下查询时,其获取错误如"ORA-00904: "R"."MEASURE": invalid identifier"
     我认为查询没错。但是我找不到这个问题。你能帮我吗... 谢谢。

SELECT  DISTINCT 0 ROW_ID,  Division , Outlet , Class , Package , Type , Measure 
FROM       NEW_OUTLET_TOTAL_PLAN_2013 S 
WHERE   NOT EXISTS
(SELECT  1
FROM    TEMP_BWXROW3  R 
WHERE   
R.Division = S.Division AND 
R.Outlet = S.Outlet AND 
R.Class = S.Class AND 
R.Package = S.Package AND 
r.type = s.type and 
R.Measure = S.Measure );

2 个答案:

答案 0 :(得分:1)

执行此操作:

SELECT *
  FROM USER_TAB_COLS
  WHERE UPPER(TABLE_NAME) = 'TEMP_BWXROW3' AND
        UPPER(COLUMN_NAME) = 'MEASURE'

这将显示使用的确切列名称。密切关注列名称的大小写(上限,下限或混合)。如果不是全部大写(即' MEASURE'),则在使用时需要将列名括在双引号中。因此,例如,如果实际的列名称为' Measure'您需要将查询更改为

SELECT  DISTINCT 0 ROW_ID,  Division , Outlet , Class , Package , Type , Measure
FROM       NEW_OUTLET_TOTAL_PLAN_2013 S 
WHERE   NOT EXISTS
(SELECT  1
FROM    TEMP_BWXROW3  R 
WHERE   
R.Division = S.Division AND 
R.Outlet = S.Outlet AND 
R.Class = S.Class AND 
R.Package = S.Package AND 
r.type = s.type and 
R."Measure" = S.Measure);

分享并享受。

答案 1 :(得分:0)

TEMP_BWXROW3中是否包含区分大小写的列名?如果是,那么使用R。" Measure" ...