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 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 refreshes. Therefore, specifying the nested and nested_refresh_mode parameters is meaningless, and the default refresh mode is independent refresh.
| 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 strategy when you create a materialized view. Valid values:
|
| refresh_parallel | The number of threads that can be used to perform the refresh operation in parallel.
NoteFor OceanBase Database V4.3.5, this parameter is supported starting from V4.3.5 BP1, and its default value is changed to 0. |
| nested | The refresh mode of the nested materialized view. Valid values:
NoteFor OceanBase Database V4.3.5, this parameter is supported starting from V4.3.5 BP3. |
| nested_refresh_mode | The refresh mode of the nested materialized view. Valid values:
NoteFor OceanBase Database V4.3.5:
|
Examples
Independent refresh mode:
Specify only the
mv_nameparameter.CALL DBMS_MVIEW.REFRESH('mv1');Specify the
mv_nameparameter and set the value of thenestedparameter tofalse.CALL DBMS_MVIEW.REFRESH('mv1', nested=> false);
Cascading inconsistent refresh mode:
Specify the
mv_nameparameter, set the value of thenestedparameter totrue, and do not specify thenested_refresh_modeparameter.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true);Specify the
mv_nameparameter, set the value of thenestedparameter totrue, and set the value of thenested_refresh_modeparameter toinconsistent.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'inconsistent');
Cascading consistent refresh mode:
Specify the
mv_nameparameter, set the value of thenestedparameter totrue, and set the value of thenested_refresh_modeparameter toconsistent.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'consistent');The following examples show error scenarios:
Set the value of the
nestedparameter tofalseand specify the value of thenested_refresh_modeparameter. An error is returned.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> false, nested_refresh_mode => 'xxxx');Do not specify the value of the
nestedparameter and specify the value of thenested_refresh_modeparameter. An error is returned.CALL DBMS_MVIEW.REFRESH('mv1', nested_refresh_mode => 'xxxx');Set the value of the
nestedparameter totrueand set the value of thenested_refresh_modeparameter to an invalid string. An error is returned.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.