I have been trying to create a materialized view...
LOG
CREATE MATERIALIZED VIEW LOG
ON cdb.reporter
TABLESPACE cdb_views
WITH PRIMARY KEY
INCLUDING NEW VALUES;
VIEW
create materialized view
mviews.mv_reporter
USING NO INDEX
REFRESH FAST
as (select
state_code,
rept_num,
ref_yy,
ref_mm,
phase,
version,
payroll_indicator,
com_code1,
com_code2,
pro_factor
from cdb.reporter
where payroll_indicator = 0
and ref_yy||ref_mm >= to_char((sysdate-790.955),'YYYYMM'));
When I do I get the error ...
from cdb.reporter
*
ERROR at line 16:
ORA-12015: cannot create a fast refresh materialized view from a complex query
When I take out the last line "and ref_yy||ref_mm >= to_char((sysdate-790.955),'YYYYMM')" it is created fine.
I supposed that the materalized view just couldn't handle that last line. But a developer ran the following on his oracle instance and he says it worked ...
CREATE MATERIALIZED VIEW LOG ON CDB.REPORTER;
create materialized view
cdb.reporter_est_view
USING NO INDEX
REFRESH FAST START WITH SYSDATE NEXT SYSDATE + 1/96
as (select
state_code,
rept_num,
ref_yy,
ref_mm,
phase,
version,
payroll_indicator,
com_code1,
com_code2,
pro_factor
from cdb.reporter
where payroll_indicator = 0
and ref_yy||ref_mm >= to_char((sysdate-182.625),'YYYYMM'));
So from what he's told me the last line is valid in a materialized view. From what I read on line, some functions are now allowed with the refresh fast option. I figured the sysdate was one.
The only other difference I see is that we're version 10.2.0.2 and he's 10.2.0.3.
Can someone explain this one to me?
THanks
JJ