Hi All,

How to create the Materialzed view using WITH clause? Using the below given code,
I'm not able to create the MV and it is disconnecing when trying to create the MV with the below code.

CREATE MATERIALIZED VIEW activity_mv
TABLESPACE DATA BUILD DEFERRED REFRESH FORCE ON DEMAND
WITH ROWID AS
WITH sum_sal AS (SELECT deptno , SUM(sal)sal_sum FROM emp GROUP BY deptno ),
cnt_emp AS (SELECT deptno , COUNT(sal)cnt_sal FROM emp GROUP BY deptno )
SELECT emp.deptno, emp.ename ,empno, sal
FROM emp , sum_sal rec1 , cnt_emp rec2
WHERE emp.deptno = rec1.deptno
AND rec1.deptno = rec2.deptno
AND sal > (sal_sum/cnt_sal )

Please let me know how to create it successfully and Oracle version is 9.2.0.7

Thanks...