Query Rewrite doesn't work when involving multiples mviews and CURSOR_SHARING is not EXACT

(Doc ID 1091754.1)

Last updated on MARCH 27, 2014

Applies to:

Oracle Server - Enterprise Edition - Version: to - Release: 10.2 to 11.1
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 QADW_ADR_FACT_TB where m5_id between 4102536 and 4102555
Here query rewrite works because only one mview is involved

Enlarging the query range
SELECT * FROM QADW_ADR_FACT_TB where m5_id between 4102536 and 4102560
No data is retrieved despite query rewrite seems to work.

Removing wheee condition returns all data correctly:


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms