I am trying to refresh a materialized view for some days and between some hours and my code:
ALTER MATERIALIZED VIEW M_MVIEW
REFRESH FORCE ON DEMAND START WITH TO_DATE('11-07-2014 10:30:00', 'DD-MM-YYYY HH24:MI:SS')
NEXT (CASE WHEN (TO_CHAR(SYSDATE,'D','NLS_SORT = XTURKISH') = 5) AND (SYSDATE BETWEEN (TRUNC(TO_DATE('10-07-2014 21:00:00', 'DD-MM-YYYY HH24:MI:SS')) + 20/24) AND (TRUNC(TO_DATE('10-07-2014 21:00:00', 'DD-MM-YYYY HH24:MI:SS')) + 31/24)) THEN TRUNC(NEXT_DAY(TO_DATE('10-07-2014 21:00:00', 'DD-MM-YYYY HH24:MI:SS'), 'PAZARTESİ')) + 7/24
WHEN (SYSDATE BETWEEN (TRUNC(TO_DATE('10-07-2014 21:00:00', 'DD-MM-YYYY HH24:MI:SS')) + 20/24) AND (TRUNC(TO_DATE('10-07-2014 21:00:00', 'DD-MM-YYYY HH24:MI:SS')) + 31/24)) THEN TRUNC(SYSDATE) + 31/24
ELSE SYSDATE + 2/24 END)
But I am getting error; ORA-06502: PL/SQL: numeric or value error%s
I tried to solve my problem but I couldn't. Does anyone have any idea for my problem?
Thanks.
For NEXT clause in a materialized view you can write CASE statement but it acceptes only two condition (it should be very simple like case when x=x then aa else bb end
). My suggestion is that simplify your condition if you can.