1. 程式人生 > >ORACLE建立物化視圖

ORACLE建立物化視圖

font logs material 建立 clas sta pre 刷新 cat

       
--使用 on commit 的方式建立物化視圖  
create materialized view emp_dept refresh on commit 
as 
select t.*,d.dname from emp t , dept d
       where  t.deptno  = d.deptno;      
       
--使用 on demand的方式建立物化視圖
create materialized view mv_name refresh force on demand start with sysdate 
       next to_date( concat( to_char( sysdate+
1,dd-mm-yyyy), 22:00:00),dd-mm-yyyy hh24:mi:ss) as select t.*,d.dname from emp t left join dept d on t.deptno = d.deptno; --用left join 不能使用 on commit 的刷新方式,但是能使用 on demand的刷新方式 create materialized view emp_dept1 refresh force on commit as select t.*,d.dname from
emp t left join dept d on t.deptno = d.deptno;

ORACLE建立物化視圖