create materialized view t_v as
select t1.*,1 as marker,rowid from t1 t1
union all
select t2.*,2 as marker,rowid from t2 t2;
ORA-00904: "ROWID" invalid identifier
经查询,第一个rowid必须设置一个别名,如下:
create materialized view t_v as
select t1.*,1 as marker,rowid as rid from t1 t1
union all
select t2.*,2 as marker,rowid from t2 t2;
问题解决。
注:也有可能会在refresh的时候出现ora-904,可参考:https://oracleblog.org/working-case/ora920-when-refresh-mview/