Has anyone tried using the DBMS_MVIEW.Refresh package, passing an array of table names as a parameter (Oracle9i Enterprise Edition Release 9.2.0.4.0) ? I can get it to work with the "list" parameter but, if I try to use the version with the "tab" parameter, I get:
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 794
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 851
ORA-06512: at "OPD.NH_OPL_PROC_MV_REFRESH", line 18
ORA-06512: at line 1
The code is:
Re-writing this into a version based on lists works fine and refreshes all my materialized views:Code:CREATE OR REPLACE PROCEDURE nh_OPL_PROC_MV_REFRESH authid current_user as CURSOR c_get_mviews is SELECT owner||'.'||mview_name FROM all_mviews WHERE mview_name like 'OPL_MV%' ; vSnapshotArray dbms_utility.uncl_array; vRefreshType Varchar2(1000); BEGIN open c_get_mviews; fetch c_get_mviews bulk collect into vSnapshotArray; close c_get_mviews; For i in vSnapshotArray.first..vSnapshotArray.last Loop DBMS_OUTPUT.PUT_LINE(vSnapshotArray(i)); vRefreshType := vRefreshType || 'C'; End loop; DBMS_OUTPUT.PUT_LINE(vRefreshType); dbms_mview.refresh( tab => vSnapshotArray, method => vRefreshType); END; / exec nh_opl_proc_mv_refresh
Code:CREATE OR REPLACE PROCEDURE nh_OPL_PROC_MV_REFRESH authid current_user as CURSOR c_get_mviews is SELECT owner||'.'||mview_name FROM all_mviews WHERE mview_name like 'OPL_MV%' ; vSnapshotArray dbms_utility.uncl_array; vRefreshType Varchar2(1000); vSnapshotList varchar2(32000); BEGIN open c_get_mviews; fetch c_get_mviews bulk collect into vSnapshotArray; close c_get_mviews; For i in vSnapshotArray.first..vSnapshotArray.last Loop DBMS_OUTPUT.PUT_LINE(vSnapshotArray(i)); vSnapshotList := vSnapshotList||vSnapshotArray(i); if i < vSnapshotArray.last then vSnapshotList := vSnapshotList||','; end if; vRefreshType := vRefreshType || 'C'; End loop; DBMS_OUTPUT.PUT_LINE(vRefreshType); dbms_mview.refresh( list => vSnapshotList, method => vRefreshType); END; / exec nh_opl_proc_mv_refresh




Reply With Quote