0

When I execute below query, its getting error like "ORA-00904: "R"."MEASURE": invalid identifier"
I think the query is not wrong. But I cant find the issue. Can you help me please... Thank you.

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 Answers 2

1

Execute this:

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

That will show you the exact column name used. Pay close attention to the case (upper, lower, or mixed) of the column name. If it's not all upper case (i.e. 'MEASURE') you'll need to enclose the column name in double-quotes when using it. So if, for example, the actual column name is 'Measure' you'd need to change your query to

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);

Share and enjoy.

3
  • -How to disable case sensitivity for column names ? Apr 22, 2013 at 12:26
  • If the table has defined with quotes like: "Column_name", then the column name is case sensitive. Apr 22, 2013 at 12:29
  • I don't believe that you can't disable it because it's built into the product. Your best bet is to rename the column using something like ALTER TABLE TEMP_BWXROW3 RENAME COLUMN "Measure" TO MEASURE. Apr 22, 2013 at 14:55
0

Do you have case sensitive column names in the TEMP_BWXROW3? If so then use R."Measure" ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.