Uderc programming article aggregator sites

Reg:package code to refresh materialized views

Tags:
Answers: Have 5 answers
Advertisement
i am new to pl/sql packages and procedures.i want it to execute for running mappings in informatica which takes 0 and gives 1 when executed successfully
create or replace PACKAGE BODY pkg_refresh_mv as
procedure prc_mv (p_mv_name varchar2) is
begin
dbms_mview.refresh (p_mv_name);
end prc_mv;
procedure refresh_all_mv (proc_response IN OUT number) is
begin
dbms_mview.refresh('materialized view','C');
dbms_mview.refresh('materialized view','C');
proc_response := 1;
exception
when others then
proc_response := 0;
end refresh_all_mv ;
end pkg_refresh_mv;
when i execute this code i get the following errors
PLS-00201: identifier 'PKG_REFRESH_MV' must be declared
PLS-00304: cannot compile body of 'PKG_REFRESH_MV' without its specification
what needs to be changed
thanks
Advertisement
The best answer: try this one :
CREATE OR REPLACE PACKAGE pkg_refresh_mv
AS
   PROCEDURE prc_mv (p_mv_name VARCHAR2);  
   PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER);
END pkg_refresh_mv;
CREATE OR REPLACE PACKAGE BODY pkg_refresh_mv
AS
   PROCEDURE prc_mv (p_mv_name VARCHAR2)
   IS
   BEGIN
      dbms_mview.refresh (p_mv_name);
   END prc_mv;
   PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER)
   IS
   BEGIN
      dbms_mview.refresh ('materialized view', 'C');
      dbms_mview.refresh ('materialized view', 'C');
      proc_response := 1;
   EXCEPTION
      WHEN OTHERS
      THEN
         proc_response := 0;
   END refresh_all_mv;
END pkg_refresh_mv;
/