Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query rewrite option is not working

Ram_AAug 10 2020 — edited Aug 17 2020

Hi Experts,

Query rewrite option is not working.

I have created the following materialized view  with "enable query rewrite option".

ALTER SESSION SET QUERY_REWRITE_ENABLED = TRUE;

create materialized VIEW mv12

REFRESH COMPLETE ON demand

enable query rewrite

as

select d.deptno,sum(e.sal) from emp e,dept d

where e.deptno=d.deptno

GROUP BY d.deptno;

The query is using tables instead of MVIEW. Could you please help me.

Why it'snot using MVIEW.

select d.deptno,sum(e.sal) from emp e,dept d

where e.deptno=d.deptno

and d.deptno=10

GROUP BY d.deptno;

Thanks in advance.

This post has been answered by Jonathan Lewis on Aug 10 2020
Jump to Answer
Comments
Post Details
Added on Aug 10 2020
5 comments
895 views