REFRESH
REFRESHE is used to refresh a specified materialized view.
Syntax
DBMS_MVIEW.REFRESH (
mv_name IN VARCHAR(65535),
method IN VARCHAR(65535) DEFAULT NULL,
refresh_parallel IN INT DEFAULT 0,
nested IN BOOLEAN DEFAULT FALSE,
nested_refresh_mode IN VARCHAR DEFAULT NULL
);
Parameter description
Non-nested materialized views do not support cascading refresh. Therefore, specifying the nested and nested_refresh_mode parameters is meaningless. By default, they are refreshed independently.
| Parameter | Description |
|---|---|
| mv_name | The name of the materialized view to be refreshed. |
| method | The refresh strategy of the materialized view. You can specify a default refresh strategy when you create a materialized view. Valid values:
|
| refresh_parallel | The concurrency of the refresh operation, that is, the number of threads that execute the refresh operation at the same time. The default value is 0 |
| nested | The refresh mode of the nested materialized view. Valid values:
|
| nested_refresh_mode | The refresh mode of the nested materialized view. Valid values:
|
Examples
-
Independent refresh:
-
Specify only the
mv_nameparameter.CALL DBMS_MVIEW.REFRESH('mv1'); -
Specify the
mv_nameparameter and set thenestedparameter tofalse.CALL DBMS_MVIEW.REFRESH('mv1', nested=> false);
-
-
Cascading inconsistent refresh:
-
Specify the
mv_nameparameter and set thenestedparameter totrue. Do not specify thenested_refresh_modeparameter.CALL DBMS_MVIEW.REFRESH(
'mv1', nested=> true); -
Specify the
mv_nameparameter and set thenestedparameter totrueand thenested_refresh_modeparameter toinconsistent.CALL DBMS_MVIEW.REFRESH(
'mv1',
nested=> true,
nested_refresh_mode => 'inconsistent');
-
-
Cascading consistent refresh:
Specify the
mv_nameparameter, set thenestedparameter totrue, and set thenested_refresh_modeparameter toconsistent.CALL DBMS_MVIEW.REFRESH(
'mv1',
nested=> true,
nested_refresh_mode => 'consistent'); -
The following examples result in errors:
-
Set the
nestedparameter tofalseand specify thenested_refresh_modeparameter.CALL DBMS_MVIEW.REFRESH(
'mv1',
nested=> false,
nested_refresh_mode => 'xxxx'); -
Do not specify the
nestedparameter and specify thenested_refresh_modeparameter.CALL DBMS_MVIEW.REFRESH('mv1', nested_refresh_mode => 'xxxx'); -
Set the
nestedparameter totrueand set thenested_refresh_modeparameter to an invalid string.CALL DBMS_MVIEW.REFRESH(
'mv1',
nested=> true,
nested_refresh_mode => 'invalid string');
-