REFRESHE is used to refresh a specified materialized view.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
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 is meaningless. 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. You can specify 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 in parallel. |
| nested | The refresh mode of a nested materialized view. Valid values:
|
| nested_refresh_mode | The refresh mode of a 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, and set the value of thenestedparameter totrue. Do not specify thenested_refresh_modeparameter.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true);Specify the
mv_name,nested, andnested_refresh_modeparameters, and set the value of thenestedparameter totrueand 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, and set the value of thenestedparameter totrueand 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:
The value of the
nestedparameter isfalse, and the value of thenested_refresh_modeparameter is specified. An error is returned.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> false, nested_refresh_mode => 'xxxx');The value of the
nestedparameter is not specified, and the value of thenested_refresh_modeparameter is specified. An error is returned.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. An error is returned.obclient> CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'illegal string');
References
For more information about refreshing a materialized view, see Refresh a materialized view.
