Hi, I have a question about nested materialized view in fast refresh mode on Oracle 11g(It support pivot function, but oracle 10g not support).
When I created, it throws "ORA-12015: cannot create a fast refresh materialized view from a complex query"
Then I used dbms_mview.explain_mview to see the reason, and it tell me the following
REFRESH_FAST_AFTER_INSERT "inline view or subquery in FROM list not supported for this type MV"
Can somebody help me, any suggestion will be appreciated
create table empX as select * from scott.emp;
alter table empX add constraint PK_empX_empno primary key (empno);
--drop MATERIALIZED VIEW LOG ON empX;
CREATE MATERIALIZED VIEW LOG ON empX with rowid, sequence(empno);
--drop MATERIALIZED VIEW mv_empX;
CREATE MATERIALIZED VIEW mv_empX
REFRESH FAST START WITH SYSDATE
NEXT SYSDATE + 1/1440
AS
select * from
(
select rowid emp_rowid, deptno, job, sal from empX
)
PIVOT( max(sal) for job IN ('ANALYST' job1, 'CLERK' job2, 'MANAGER' job3));
--select * from mv_capabilities_table
declare
lv_sqltext varchar2(4000);
begin
execute immediate 'truncate table mv_capabilities_table';
lv_sqltext := 'select * from
(
select deptno, job, sal from empX
)
PIVOT( max(sal) for job IN (''ANALYST'' job1, ''CLERK'' job2, ''MANAGER'' job3))
';
dbms_mview.explain_mview(lv_sqltext,'nested=>TRUE');
commit;
end;
/