REFRESHE is used to refresh a specified materialized view.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL-compatible mode.
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]
);
Parameters
Note
Non-nested materialized views do not support cascading refresh. Specifying the nested and nested_refresh_mode parameters has no effect. By default, independent refresh is performed.
| Parameter | Description |
|---|---|
| mv_name | The name of the materialized view to be refreshed. |
| method | The refresh strategy of the materialized view. This parameter specifies the default refresh strategy when you create a materialized view. Valid values:
|
| refresh_parallel | The concurrency level of the refresh operation, that is, the number of threads that can be executed simultaneously. |
| nested | The refresh mode of the nested materialized view. Valid values:
|
| nested_refresh_mode | The refresh behavior of cascading refresh on the nested materialized view. Valid values:
|
Examples
Independent refresh:
Specify only the
mv_nameparameter.obclient> CALL DBMS_MVIEW.REFRESH('mv1');Specify the
mv_nameandnestedparameters, and set the value of thenestedparameter tofalse.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> false);
Non-consistent cascading refresh:
Specify the
mv_nameandnestedparameters, set the value of thenestedparameter totrue, and do not specify thenested_refresh_modeparameter.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true);Specify the
mv_name,nested, andnested_refresh_modeparameters, set the value of thenestedparameter totrue, and set the value of thenested_refresh_modeparameter toinconsistent.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'inconsistent');
Consistent cascading refresh:
Specify the
mv_name,nested, andnested_refresh_modeparameters, 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 examples show error scenarios:
If the value of the
nestedparameter isfalseand the value of thenested_refresh_modeparameter is specified, an error will be returned.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> false, nested_refresh_mode => 'xxxx');If the value of the
nestedparameter is not specified and the value of thenested_refresh_modeparameter is specified, an error will be returned.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested_refresh_mode => 'xxxx');If the value of the
nestedparameter istrueand the value of thenested_refresh_modeparameter is an invalid string, an error will be returned.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'illegal string');
References
For more information about refreshing materialized views, see Refresh a materialized view.