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]
[, async IN BOOLEAN DEFAULT FALSE]
);
Parameters
Note
Non-nested materialized views do not support cascading refresh. Specifying the nested and nested_refresh_mode parameters is meaningless; by default, they are refreshed independently.
Parameter |
Note |
|---|---|
| mv_name | The name of the materialized view to be refreshed. |
| method | You can define a refresh strategy for a materialized view by specifying the default strategy when creating the view. Valid methods include:
|
| refresh_parallel | The concurrency level of the refresh operation, which is the number of threads that perform the refresh operation simultaneously. |
| nested | Specifies the refresh mode for a nested materialized view. Valid values:
|
| nested_refresh_mode | Specifies whether the cascading refresh of nested materialized views is a consistent or non-consistent refresh. Valid values:
|
| async | Specifies whether to perform an asynchronous refresh. Valid values:
|
Examples
Independent refresh mode:
Only the
mv_nameparameter is specified.obclient> CALL DBMS_MVIEW.REFRESH('mv1');The
mv_nameparameter and thenestedparameter are specified with a value offalse.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> false);
Cascading non-consistent refresh mode:
The
mv_nameparameter is specified, the value of thenestedparameter istrue, and thenested_refresh_modeparameter is not specified.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true);The
mv_nameparameter is specified, the value of thenestedparameter istrue, and the value of thenested_refresh_modeparameter isinconsistent.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'inconsistent');
Cascade consistent refresh mode:
Specify the parameter
mv_name, set the value of thenestedparameter totrue, and set the value of thenested_refresh_modeparameter toconsistent.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'consistent');The following are the error scenarios:
An error is reported when the value of the
nestedparameter isfalseand the value of thenested_refresh_modeparameter is specified.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> false, nested_refresh_mode => 'xxxx');An error is returned if the value of the
nested_refresh_modeparameter is specified but the value of thenestedparameter is not specified.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested_refresh_mode => 'xxxx');The value of the
nestedparameter istrue, and the value of thenested_refresh_modeparameter is an invalid string, causing an error.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'Invalid string');
References
For more information about refreshing materialized views, see Refresh a materialized view.