My Oracle Support Banner

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 11.1.0.7 [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.

Symptoms

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

Enlarging the query range
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>

Cause

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
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.