Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Refreshing a MView using Job scheduler

Rupa MohanMar 1 2018 — edited Mar 5 2018

Hi,

I am trying to refresh a materialized view using the DBMS_SCHEDULER job. But the refresh is not occurring for the MView.

BEGIN

DBMS_SCHEDULER.CREATE_JOB

(

JOB_NAME            => 'REFRESH_MVIEW',

JOB_TYPE            => 'PLSQL_BLOCK',

JOB_ACTION          => 'BEGIN EXEC DBMS_MVIEW.REFRESH("TESTR7"); END;',

NUMBER_OF_ARGUMENTS => 0,

START_DATE          => '01-MAR-2018 10:32:00 AM',

REPEAT_INTERVAL     => 'FREQ=MINUTELY;BYHOUR=3; BYMINUTE=39;',

END_DATE            => NULL,

ENABLED             => TRUE,

AUTO_DROP           => FALSE,

COMMENTS            => 'JOB TO REFRESH'

);

END;

create materialized view testr7

build immediate

refresh complete

disable query rewrite

as

select * from table (all_emps);

create or replace

function all_emps return emp_tab

   is

   l_emp_tab emp_tab := emp_tab();

   n integer := 0;

    begin

       for r in (select empno, ename from emp)

       loop

          l_emp_tab.extend;

          n := n + 1;

        l_emp_tab(n) := emp_obj(r.empno, r.ename);

      end loop;

      return l_emp_tab;

   end;

 

Thanks in advance.

Regards,

Rupa

This post has been answered by Solomon Yakobson on Mar 2 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2018
Added on Mar 1 2018
9 comments
4,601 views