0

I have a few Materialized Views that I need to update weekly and monthly.

So for the weekly I'm using:

execute DBMS_REFRESH.MAKE(
name=>'LPMVRefresh_Weekly_1',
list=>'mySchema.MV1_mv,mySchema.MV2_mv',
next_date => TO_DATE('2013-09-08:00:30:00','YYYY-MM-DD:HH24:MI:SS'),
interval =>'sysdate+7');

How can I do so they refresh monthly, say every 1st of the month at 1 am? Is there something like Interval => sysdate+monthly?

1 Answer 1

2

Next month's 1st day 1am can be calculated using the following SQL:

SELECT TRUNC(ADD_MONTHS(SYSDATE,1), 'MONTH')+1/24 AS ANSWER FROM DUAL;

The most probably it can be simplified.

1
  • Thanks! Base on your comment, I went with interval =>'ADD_MONTHS(SYSDATE,1)'
    – Diomedes
    Commented Sep 11, 2013 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.