Difference between View and Materialized View

Difference between View and Materialized  View :- 


--====================================================
--# difference between view and materialized view
--====================================================

DROP VIEW XXSD_EMP_V

select * from xxsd_emp_tl --where deptno = 20

select * from xxsd_DEPT_tl --where deptno = 20

select EMPNO, ENAME, JOB, A.DEPTNO, DNAME from  xxsd_emp_tl A, xxsd_DEPT_tl B  where A.deptno = B.deptno AND A.deptno = 20

create or replace view XXSD_EMP_V
as
--select EMPNO, ENAME, JOB, DEPTNO from  xxsd_emp_tl where deptno = 20
select EMPNO, ENAME, JOB, A.DEPTNO, DNAME from  xxsd_emp_tl A, xxsd_DEPT_tl B  where A.deptno = B.deptno AND A.deptno = 20

select * from XXSD_EMP_V


select *  from all_objects
where object_name = 'XXSD_EMP_V'


select * from ALL_VIEWS
where VIEW_NAME = 'XXSD_EMP_V'


--==============  MATERIALIZED VIEW =======================
SYNTAX:-

CREATE MATERIALIZED VIEW XXSD_EMP_M_V
AS
SELECT * FROM xxsd_emp_tl where deptno = 10

DROP MATERIALIZED VIEW XXSD_EMP_M_V

select * from XXSD_EMP_M_V


update xxsd_emp_tl
set COMM = COMM+100
where deptno = 10

commit;

SELECT * FROM xxsd_emp_tl where deptno = 10

select * from XXSD_EMP_M_V

--- Refresh Command-----

EXEC DBMS_MVIEW.refresh('XXSD_EMP_M_V');


select object_name, object_type from all_objects
where object_name = 'XXSD_EMP_M_V'


select * from ALL_MVIEWS
where MVIEW_NAME LIKE '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