Link to home
Start Free TrialLog in
Avatar of pooja74
pooja74

asked on

Views Creation

Please write me the steps to create the materilized views.I have five views to be created as materilized views.I want to place them in DBMS_REFRESH to get refreshed together.
I want to do refresh  of views in every two hours.
Thx in advance.
Avatar of Tony_Hasler
Tony_Hasler

I am not sure what you want.  There are a lot of options for materialized views.  For instance, the following is a modified example of an aggregate view from the Oracle documentation.  You can then refresh it by using the DBMS_REFRESH package.

Is it the DBMS_REFRESH package that you need help on?  If not could you be more specific about what you want, and I can perhaps give you the SQL.

CREATE MATERIALIZED VIEW sales_mv
   BUILD IMMEDIATE
   REFRESH COMPLETE ON DEMAND
   AS SELECT t.calendar_year, p.prod_id,
      SUM(s.amount_sold) AS sum_sales
      FROM times t, products p, sales s
      WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
      GROUP BY t.calendar_year, p.prod_id;

Avatar of pooja74

ASKER

Thx for the reply ,But please include the syntax also  the clause for refresh of the view  in every two hours also.
Thx
The syntax is:

Create materialized view [view name]
refresh fast next sysdate + 1/12
as
select ...
from ...
where ...

this will do a fast refresh every two H`s, starting from two H`s after view creation.
Avatar of pooja74

ASKER

Thx please send me the syntax for creation of group in dbms_refresh and using dbms_refesh for the group.And when we are using dbms_refresh we should use use refresh fast next sysdate + 1/12  in view or not.And if we not using then what is the syntax for creation of  materilaized view with dbms_refresh.
This is urgent please reply.
Thx in advance.,
ASKER CERTIFIED SOLUTION
Avatar of Eladla
Eladla
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial