ORA-00904: “from$_subquery$_014”.“column_name”: invalid identifier

别来无恙 提交于 2021-02-08 08:18:53

问题


After the migration of my oracle db im getting below error:

ORA-00904: "from$_subquery$_014"."TRN_TERMINAL_SOFTWARE_VERSION": invalid identifier

below is my query:

SELECT
  *
FROM
  (
    SELECT
      SUM(trn_amt)   AS amount,
      SUM(trn_count) AS COUNT ,
      timetype       AS period ,
      seq ,
      ROW_NUMBER() OVER (ORDER BY vw.seq DESC) AS RowNumber
    FROM
      YSD_STORE_FORWARD_V vw
    INNER JOIN store_dimension std                 ON vw.stm_id=std.std_id
    INNER JOIN card_type_dimension ctd             ON vw.CTD_CARD_ABBV=ctd.CTD_CARD_ABBV
    INNER JOIN STPLDBTEMP.store_group_relation sgr ON std.STD_ID= sgr.sgr_store_id
    INNER JOIN location_dimension ld               ON ld.lod_id=std.std_location_id
WHERE
  start_date BETWEEN 20170405 AND 20170405
AND std.std_corp_id    ='1939'
AND sgr.sgr_sgm_id     ='2160'
AND ctd.CTD_CARD_ABBV IN ('VE','VI','VS','VD','AX','AE','MD','MC','MF','XX'
  ,'DB','JB','NV','DS','EB','EBC','EBF','EBW','VF','VG','WX','DC','GF','PL'
  ,'PW','NM','BG','GC','FL','FO','FT','FW','INV','IV','IN','CP')
AND LD.LOD_COUNTRY_ID = 1
GROUP BY
  timetype ,
  seq
ORDER BY
  4

);

I'm not using column in my query still I'm getting this error, Please help me out YSD_STORE_FORWARD_V its a View which is using materialized view contain TRN_TERMINAL_SOFTWARE_VERSION column but my working is fine.


回答1:


This is a bug in Oracle 11.2.0.4, it appears randomly in queries using subqueries or ansi join.

In my case I found the root cause: It was caused when I did a expdp from 11.2.0.4 and the schema has MATERIALIZED VIEWS. Then I did an impdp in other DataBase (10g, 11g and even 12c). Some kind of diccionary problem causes the bug.

I solved doing this:

  1. EXPDP excluding MATERIALIZED_VIEWS

  2. IMPDP. There were some errors related to MATERIALIZED_VIEW objects, wich were ignored.

  3. Create manually all the MATERIALIZED_VIEW objects.

  4. Recompile all objects in database, using “$ORACLE_HOME/rdbms/admin/utlrp.sql”

This is an extract of the bug documentation:

Bug 17551261 ORA-904 "from$_subquery$_003". with query rewrite

This note gives a brief overview of bug 17551261. The content was last updated on: 21-FEB-2014

Affects:

Product (Component) Oracle Server (Rdbms)

Range of versions believed to be affected Versions BELOW 12.1

Versions confirmed as being affected 11.2.0.4

Platforms affected Generic (all / most platforms affected)

It is believed to be a regression in default behaviour thus:
Regression introduced in 11.2.0.4

Fixed: The fix for 17551261 is first included in • 12.1.0.1 (Base Release)

Description This problem is introduced in 11.2.0.4 by the fix for bug 14049796 .

If an ORA-904 similar to the following is raised:
ORA-00904: "from$_subquery$_003"."SUBSCRIBER_SID": invalid identifier from a SQL statement using ANSI joins, then it may be a case of this bug if all of the following are true:

1) Summary rewrite is used

2) fix to bug:14049796 present (this fix is included in 11.2.0.4)

3) The errorstack includes kkogvcd() and kkqsgen()

Workaround Disable query rewrite



来源:https://stackoverflow.com/questions/43255769/ora-00904-from-subquery-014-column-name-invalid-identifier

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!