Skip to main content

REFRESH

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
);

Parameter description

info

Non-nested materialized views do not support cascading refresh. Therefore, specifying the nested and nested_refresh_mode parameters is meaningless. By default, they are refreshed independently.

ParameterDescription
mv_nameThe name of the materialized view to be refreshed.
methodThe refresh strategy of the materialized view. You can specify a default refresh strategy when you create a materialized view. Valid values:
  • 'f' or 'F': fast refresh.
  • '?': force refresh.
  • 'C' or 'c': complete refresh.
  • 'A' or 'a': complete refresh.
refresh_parallelThe concurrency of the refresh operation, that is, the number of threads that execute the refresh operation at the same time. The default value is 0
nestedThe refresh mode of the nested materialized view. Valid values:
  • FALSE: default value, indicating that the nested materialized view is refreshed independently.
  • TRUE: indicating that the nested materialized view is cascading refreshed.
nested_refresh_modeThe refresh mode of the nested materialized view. Valid values:
  • When the nested parameter is specified as FALSE, specifying the nested_refresh_mode parameter will result in an error.
  • When the nested parameter is specified as TRUE:
    • Specify the nested_refresh_mode parameter as follows:
      • inconsistent: indicating that the nested materialized view is cascading refreshed in an inconsistent manner.
      • consistent: indicating that the nested materialized view is cascading refreshed in a consistent manner.
    • By default, the nested materialized view is cascading refreshed in an inconsistent manner.

Examples

  • Independent refresh:

    • Specify only the mv_name parameter.

      CALL DBMS_MVIEW.REFRESH('mv1');
    • Specify the mv_name parameter and set the nested parameter to false.

      CALL DBMS_MVIEW.REFRESH('mv1', nested=> false);
  • Cascading inconsistent refresh:

    • Specify the mv_name parameter and set the nested parameter to true. Do not specify the nested_refresh_mode parameter.

      CALL DBMS_MVIEW.REFRESH(
      'mv1', nested=> true);
    • Specify the mv_name parameter and set the nested parameter to true and the nested_refresh_mode parameter to inconsistent.

      CALL DBMS_MVIEW.REFRESH(
      'mv1',
      nested=> true,
      nested_refresh_mode => 'inconsistent');
  • Cascading consistent refresh:

    Specify the mv_name parameter, set the nested parameter to true, and set the nested_refresh_mode parameter to consistent.

    CALL DBMS_MVIEW.REFRESH(
    'mv1',
    nested=> true,
    nested_refresh_mode => 'consistent');
  • The following examples result in errors:

    • Set the nested parameter to false and specify the nested_refresh_mode parameter.

      CALL DBMS_MVIEW.REFRESH(
      'mv1',
      nested=> false,
      nested_refresh_mode => 'xxxx');
    • Do not specify the nested parameter and specify the nested_refresh_mode parameter.

      CALL DBMS_MVIEW.REFRESH('mv1', nested_refresh_mode => 'xxxx');
    • Set the nested parameter to true and set the nested_refresh_mode parameter to an invalid string.

      CALL DBMS_MVIEW.REFRESH(
      'mv1',
      nested=> true,
      nested_refresh_mode => 'invalid string');