Materialized view with BUILD clause in Oracle

Materialized view with BUILD clause in Oracle :- 




The BUILD clause options are shown below.
         
IMMEDIATE
The materialized view is populated immediately.
DEFERRED
The materialized view is populated on the first requested refresh.


The following refresh types are available.

FAST
A fast refresh is attempted. If materialized view logs are not present against the source tables in advance, the creation fails.
COMPLETE
The table segment supporting the materialized view is truncated and repopulated completely using the associated query.
FORCE
A fast refresh is attempted. If one is not possible a complete refresh is performed.

A refresh can be triggered in one of two ways.

ON COMMIT
The refresh is triggered by a committed data change in one of the dependent tables.
ON DEMAND
The refresh is initiated by a manual request or a scheduled task.


The BUILD clause options are shown below.

--===========MATERIALIZED VIEW === with BUILD IMMEDIATE ============

The BUILD clause options are shown below.

1. IMMEDIATE : The materialized view is populated immediately.
2. DEFERRED : The materialized view is populated on the first requested refresh.

EXAMPLE:-
CREATE MATERIALIZED VIEW XXSD_EMP_M_V
BUILD  IMMEDIATE
REFRESH FORCE
ON DEMAND
AS
SELECT * FROM xxsd_emp_tl where deptno = 10

DROP MATERIALIZED VIEW XXSD_EMP_M_V

select * from XXSD_EMP_M_V

--===========MATERIALIZED VIEW === with BUILD DEFERRED ============

The BUILD clause options are shown below.

1. IMMEDIATE : The materialized view is populated immediately.
2. DEFERRED : The materialized view is populated on the first requested refresh.

EXAMPLE:-
CREATE MATERIALIZED VIEW XXSD_EMP_M_V
BUILD  DEFERRED
REFRESH FORCE
ON DEMAND
AS
SELECT * FROM xxsd_emp_tl where deptno = 10

DROP MATERIALIZED VIEW XXSD_EMP_M_V

select * from XXSD_EMP_M_V

EXEC DBMS_MVIEW.refresh('XXSD_EMP_M_V');



Comments

Popular posts from this blog

E-Text Report In Fusion | Types of E-Text reports

Supplier API's

How to pass default Parameter in cursor