博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
物化视图基于rowID快速刷新
阅读量:5729 次
发布时间:2019-06-18

本文共 1642 字,大约阅读时间需要 5 分钟。

--1创建log
create MATERIALIZED VIEW LOG ON gh_qyghgx WITH rowid;
create MATERIALIZED VIEW LOG ON gh_qyxx WITH rowid;
--2创建物化视图
create materialized view GH_QYGHGX_QYXX_UNION
REFRESH FAST ON DEMAND
AS
SELECT a.rowid as ar,gx.rowid gxid, A.QYBM,
A.TYSHXYDM,
A.nsrsbh,
A.zzjgdm,
A.QYMC,
A.QYZT,
A.SJJYDZ,
A.Gsrs,
GX.ghmc1 ,
GX.ghmc2 ,
GX.ghmc3 ,
GX.ghmc4 ,
GX.ghmc5,
GX.ghmc6 ,
GX.GHDM1,
GX.GHDM2,
GX.GHDM3,
GX.GHDM4,
GX.GHDM5,
GX.GHDM6,
GX.JHZT
from GH_QYGHGX GX
,GH_QYXX A
where A.QYBM = GX.QYBM;
--3创建索引
CREATE INDEX IN_GH_QYGHGX_QYXX_un_GHDM1 ON GH_QYGHGX_QYXX_UNION (GHDM1);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_GHDM2 ON GH_QYGHGX_QYXX_UNION (GHDM2);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_GHDM3 ON GH_QYGHGX_QYXX_UNION (GHDM3);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_GHDM4 ON GH_QYGHGX_QYXX_UNION (GHDM4);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_GHDM5 ON GH_QYGHGX_QYXX_UNION (GHDM5);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_GHDM6 ON GH_QYGHGX_QYXX_UNION (GHDM6);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_GSRS ON GH_QYGHGX_QYXX_UNION (GSRS);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_JHZT ON GH_QYGHGX_QYXX_UNION (JHZT);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_NSRSBH ON GH_QYGHGX_QYXX_UNION (NSRSBH);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_QYMC ON GH_QYGHGX_QYXX_UNION (QYMC);
CREATE INDEX IN_GH_QYGHGX_QYXX_un_TYSHXYDM ON GH_QYGHGX_QYXX_UNION (TYSHXYDM);

 

--4.创建存储过程(刷新需要大写)

create or replace procedure GH_QYGHGX_QYXX_UNION_PRO as
declare
begin
dbms_mview.refresh('GH_QYGHGX_QYXX_UNION');
end;
--5.设置定时刷新
declare
variable job1 number;
begin
dbms_job.submit(:job1,'GH_QYTCHF_LS_PRO;GH_QYGHGX_QYXX_UNION_PRO;',sysdate,'sysdate+5/1440');
end;

 

转载于:https://www.cnblogs.com/523823-wu/p/8710261.html

你可能感兴趣的文章
iOS常用的封装方法
查看>>
Android之androidmainfest.xml配置文件详解
查看>>
python下划线变量的含义
查看>>
点滴积累【other】---.net程序员面试题总结
查看>>
HDU 5289 Assignment
查看>>
进程、线程、协程的基本解析(python代码)
查看>>
python 多进程
查看>>
Centos7从3.10升级内核到4.9后无法启动解决办法:mpt[23]sas驱动问题
查看>>
Free中的buffer和cache理解
查看>>
SQL Server中索引的概念,原理以及其他
查看>>
Cocos2d-x Physics 3 - 掉落的头像
查看>>
四种拦截方式
查看>>
邮件协议概述
查看>>
java Https工具类
查看>>
学期总结(一)------文献挖掘
查看>>
jqGrid细节备注—jqGrid中自定义格式,URL格式
查看>>
LeetCode - Serialize and Deserialize Binary Tree
查看>>
Memcached、Redis和MongoDB的区别
查看>>
centos忘记密码怎么办?
查看>>
SSH整合笔记
查看>>