The REFRESH procedure refreshes the 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
For non-nested materialized views, cascaded refreshes do not exist. Therefore, the nested and nested_refresh_mode parameters are invalid and the default value is independent refreshes.
| Parameter | Description |
|---|---|
| mv_name | The name of the materialized view to be refreshed. |
| method | The refresh strategy for the materialized view. You can specify a default strategy when you create a materialized view. Valid values:
|
| refresh_parallel | The number of threads that execute the refresh operation at the same time.
NoteFor OceanBase Database V4.3.5, the default value for this parameter is changed to 0 starting from version V4.3.5 BP1. |
| nested | The refresh mode of the nested materialized view. Valid values:
NoteFor OceanBase Database V4.3.5, the |
| nested_refresh_mode | The refresh mode of the cascaded nested materialized view. Valid values:
NoteFor OceanBase Database V4.3.5, the |
Examples
Independent refreshes:
Specify only the
mv_nameparameter.CALL DBMS_MVIEW.REFRESH('mv1');Specify the
mv_nameandnestedparameters and set their values tofalse.CALL DBMS_MVIEW.REFRESH('mv1', nested=> false);
Cascaded inconsistent refreshes:
Specify the
mv_name,nestedparameters, and do not specify thenested_refresh_modeparameter.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true);Specify the
mv_name,nestedparameters, and set their values totrueandinconsistent, respectively.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'inconsistent');
Cascaded consistent refreshes:
Specify the
mv_name,nestedparameters, and set their values totrueandconsistent, respectively.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> true, nested_refresh_mode => 'consistent');Error scenarios:
The
nestedparameter is set tofalse, and thenested_refresh_modeparameter is specified. An error is returned.CALL DBMS_MVIEW.REFRESH( 'mv1', nested=> false, nested_refresh_mode => 'xxxx');The
nested_refresh_modeparameter is specified, but thenestedparameter is not specified. An error is returned.CALL DBMS_MVIEW.REFRESH('mv1', nested_refresh_mode => 'xxxx');The
nestedparameter is set totrue, and thenested_refresh_modeparameter is set 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.