Search notes:

Oracle: DBMS_MVIEW.REFRESH

Because dbms_mview is a synonym for dbms_snapshot, dbms_snapshot.refresh is equivalent to dbms_snapshot.refresh.

Calling refresh commits the current transaction

The following example demonstrates that calling dbms_mview.refresh commits the current transaction.
create table tq84_r1 (
   a   varchar2(3),
   b   number
);

insert into tq84_rl values ('foo',   1);
insert into tq84_r1 values ('foo',   2);
insert into tq84_r1 values ('foo',   3);

insert into tq84_r1 values ('bar',  40);
insert into tq84_r1 values ('bar',  50);

insert into tq84_r1 values ('baz', 100);

create materialized view tq84_mv
   refresh force on demand
as
   select
      a,
      sum(b) sum_b
  from
     tq84_r1
  group by
     a;

insert into tq84_r1 values ('foo',  4);
insert into tq84_r1 values ('bar', 10);

select * from tq84_mv;

create procedure refresh_ as
    dummy number;
begin
    dbms_snapshot.refresh('tq84_mv');

--  Refresh stays in effect, although next line
--  throws error:
    dummy := 42/0;
end refresh_;
/

exec refresh_;
select * from tq84_mv;
rollback;
select * from tq84_mv;

drop procedure refresh_;
drop materialized view tq84_mv;
drop table tq84_r1;
Github repository Oracle-Patterns, path: /Installed/dbms/snapshot/refresh_commit.sql

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758208081, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/installed/packages/dbms/mview/api/refresh/index(89): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78