-
删除物化视图
DROP MATERIALIZED VIEW YOUR_VIEW_NAME;
-
创建物化视图
--创建定时刷新的物化视图 (指定物化视图每天刷新一次):
CREATE MATERIALIZED VIEW MV_NAME REFRESH FORCE ON DEMAND
START WITH SYSDATE NEXT
SYSDATE + 1
AS SELECT * FROM YOUR_VIEW_SQL;
--上述创建的物化视图每天刷新,但是没有指定刷新时间,如果要指定刷新时间(比如每天晚上10:00定时刷新一次):
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 * FROM YOUR_VIEW_SQL;