Reputation: 23
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.
Upvotes: 2
Views: 2160
Reputation: 348
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:
EXPDP excluding MATERIALIZED_VIEWS
IMPDP. There were some errors related to MATERIALIZED_VIEW objects, wich were ignored.
Create manually all the MATERIALIZED_VIEW objects.
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.4Fixed: 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
Upvotes: 4