I'm trying to create a materialized view with a left outer join and a group by.
I'm getting this error:
Error report - ORA-12015: cannot create a fast refresh materialized view from a complex query 12015. 00000 - "cannot create a fast refresh materialized view from a complex query"
Cause: Neither ROWIDs and nor primary key constraints are supported for complex queries.
Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETE option or create a simple materialized view.
The code:
CREATE MATERIALIZED VIEW CSPRD.MV_LLATTRDATA_MAX_VERSIONS
PARALLEL 16
USING INDEX
REFRESH
NEXT trunc(SYSDATE, 'hh') + 1/24
FAST
WITH ROWID
USING DEFAULT LOCAL ROLLBACK SEGMENT
ENABLE QUERY REWRITE
AS
SELECT /*+ PARALLEL(16) */
AD.ID,
AD.DEFID,
AD.ATTRID,
MAX(AD.VERNUM) MAX_VERNUM,
MAX(AD.DEFVERN) MAX_DEFVERN,
AD.ROWID,
DT.ROWID
FROM csprd.mv_llattrdata_shrunk_v1 AD, MV_DTREECORE_SHRUNK_V2 DT
WHERE AD.ID = DT.DATAID(+)
GROUP BY AD.ID, AD.DEFID, AD.ATTRID;