Jeg har demonstreret i trin, hvor en materialiseret visning opdateres efter hvert one minute
,for at have en mv, der opdateres efter 5 minutter, brug next(sysdate+5/1440)
Trin 1:
Create table temp (A int);
Trin 2:
Create Materialized view temp_mv
refresh complete start with (sysdate) next (sysdate+1/1440) with rowid
as select * from temp;
Trin 3:
select count(*) from temp;
COUNT(*)
----------
0
Trin 4:
select count(*) from temp_mv;
COUNT(*)
----------
0
Trin 5:
begin
for i in 1..10 loop
insert into temp values (i+1);
end loop;
end;
/
Trin 6:
commit;
Trin 7:
select count(*) from temp;
COUNT(*)
----------
10
Trin 8:
select count(*) from temp_mv;
COUNT(*)
----------
0
Trin 9:
select to_char(sysdate,'hh:mi') from dual;
TO_CH
-----
04:28
Trin 10:
select to_char(sysdate,'hh:mi') from dual;
TO_CH
-----
04:29
Trin 11:
select count(*) from temp;
COUNT(*)
----------
10
Trin 12:
select count(*) from temp_mv;
COUNT(*)
----------
10