Oracle查询库中已有存储过程、创建定时刷新视图、角色权限传递、创建序列触发器

SELECT * FROM V$ACCESS O WHERE O.TYPE LIKE 'PROCEDURE%'

创建物化视图且定时刷新
create materialized view mv_name refresh force on demand start with sysdate next sysdate + 1
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')

GRANT SELECT ON <表名或视图名> TO <用户名>
GRANT <SELECT/INSERT....>ON <表名或视图名> TO <用户名>

-- 创建序列
CREATE SEQUENCE SEQ_MSS_GC_DDPH
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH 1
INCREMENT BY 1
NOCACHE ORDER;

-- 创建触发器
CREATE OR REPLACE TRIGGER TRIGGER_MSS_GC_DDPH BEFORE INSERT ON MSS_GC_DDPH
FOR EACH ROW
WHEN (NEW.DDPHID IS NULL)
BEGIN
SELECT SEQ_MSS_GC_DDPH.NEXTVAL INTO :NEW.DDPHID FROM DUAL;
END;

posted @ 2018-05-04 17:13  Dream_Lasting  阅读(250)  评论(0编辑  收藏  举报