Query Rewrite doesn't work when involving multiples mviews and CURSOR_SHARING is not EXACT
(Doc ID 1091754.1)
Last updated on OCTOBER 17, 2019
Applies to:Oracle Database - Enterprise Edition - Version 10.2.0.1 to 126.96.36.199 [Release 10.2 to 11.1]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.
-- Problem Statement:
When a query involves more than 1 materialized view (mview) the explain plan shows that optimizer uses multiple mviews but nothing is returned and no errors are returned. This doesn't happen when a where condition is applied to the queries: the explain plan shows multiple mviews access and data are returned correctly. If a where condition that involves just one mview is added on select, correct data is retrieved.
-- Steps To Reproduce:
SELECT * from <mview name> where m5_id between 4102536 and 4102555
Here query rewrite works because only one mview is involved
SELECT * FROM <mview name> where m5_id between 4102536 and 4102560
No data is retrieved despite query rewrite seems to work.
Removing where condition returns all data correctly:
SELECT * FROM <mview name>
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document