create or replace TRIGGER REFRESH_REST_VIEW : z7 X1 `+ v* m+ V/ t- a AFTER 2 H% V0 z: c5 n& C: E INSERT OR UPDATE$ @2 e! _4 w$ L# q
ON tbl_contract 3 l. _1 Q# q6 J( \, S. p4 ?$ a0 H BEGIN " H2 z* c$ [; g- e- _/ s execute DBMS_MVIEW.REFRESH(‘REST_VIEW’); 6 b' y) q) j1 D7 _3 X c q9 q4 r END REFRESH_REST_VIEW;2 T: \- [1 h% b8 D2 G3 e* K! Z
commit;0 ^& v5 _* q- Q; Q; e7 t9 M9 W( P
这是我用来刷新实例视图的。SQL但它说..# ?# F# l- v" R) z
Warning: execution completed with warningTRIGGER REFRESH_REST_VIEW Compiled.PS:当表数据(由Materialized View任何使用)DML触发器将在操作过程中执行。 9 g+ F3 C3 u( \. d我已经在Google搜索了足够多的内容,很多帖子都说有可能,但我没有。我试图使用传统的触发器语法,但它不起作用。' B0 P: Q- e3 S) y3 f2 W; V 更新: 6 \1 g0 A, W2 v2 w1 D% `, w; W现在,我试着用过程和触发器做同样的操作。& z4 T) m* ]. w
create or replacePROCEDURE Rfresh_mate_views AS BEGIN DBMS_MVIEW.REFRESH('REST_VIEW'); END Rfresh_mate_views;create or replace trigger refresh_company_mviewafter insert or update ON BCD.BCD_COMPANYbeginRFRESH_MATE_VIEWS(); end refresh_company_mview;所有内容都已成功编译,但在表中更新时显示:. @- t/ S( x. n. y# Q: K- W
ORA-04092: cannot COMMIT in a triggerORA-06512: at "SYS.DBMS_SNAPSHOT",line 2449ORA-06512: at "SYS.DBMS_SNAPSHOT",line 2429ORA-06512: at "BCD.RFRESH_MATE_VIEWS",line 3ORA-06512: at "BCD.REFRESH_COMPANY_MVIEW",line 2ORA-04088: error during execution of trigger 'BCD.REFRESH_COMPANY_MVIEW - E3 A7 ?2 I: r( w解决方案: