You Asked
CREATE MATERIALIZED VIEW KOOWN.MV_DUPLICATE_EQP_PARTS1
REFRESH COMPLETE ON DEMAND
AS
select storinf.stor_nm as StoreNumber,
rsp.wo_id,decode(wo.wo_stts_lkup_id,'1559','Completed','1560','Finalized') as WorkOrderStatus,
st_eqp.stor_eqp_id,st_eqp.eqp_id,rsp.wo_rspn_id,
(select eqp_styp_nm from t_eqp_styp where eqp_styp_id =(select eqp_styp_id from t_eqp where eqp_id =st_eqp.eqp_id)) as EquipmentName,
decode(st_eqp.lctn_lkup_id,'7262','BACKROOM','7263','CREW-SERVED','7264','DRIVE THRU','7265','SELF SERVE') as Location,
st_eqp.lctn_nbr as LocationNumber,
decode(rsp.ok_ind,'0','NOK','1','OK','-1','OK'),
decode(PBLM_LKUP_ID,'2305','MCDONALDS PARIS, JACKIE & CURTIS','2305','Possible Consumer Issue','2306','Defective','2307','Flooded','2309','Leaking',
'2310','Obstructed','2312','Part Missing','2313','Out of Specification','2314','MCDONALDS BREWER, WILLIAM','2314','Substandard Performance',
'2317','MCDONALDS/RJD ENTERPRISES DAVIES, ROBERT','2317','Maintenance Requirement','2318','Abandoned','2315','Too Cold (Frozen)',
'2308','MCDONALDS/FIVE DEE ENTERPRISES DRESNICK,','2308','Improper Installation','2322','Dirty','2324','Destroyed','2325','Upgrade Required')as PartProblem,
decode(ACTN_LKUP_ID,'2270','ADJ/CAL','2271','REPAIR','2272','MCDONALDS/THORNTON ENTERPRISES THORNTON,','2272','REPLACE','2273','INSTALLED','2274','FOLLOW-UP','2275','MCDONALDS/AJR, INC. RAFFA, TONY','2275','PRE-APPROVED','2276','MGR-DECLINED','2277','SEND') as Action,
decode(PART_ACT_LKUP_ID,'2151','Send Parts','2152','MCDONALDS ROBINSON-MANG, DRU','2152','Follow Up','2153','Parts Used') as ActionOnPart,
prt.PART_QTY, prt.ESCL_IND,prt.QSA_QUAL_CRTC_IND,prt.FUP_CPLT_IND,prt.FUP_CPLT_DT,prt.CMNT_TXT
from t_wo_part prt,t_wo_rspn rsp, t_wo wo, t_eqp_styp eqp_styp,t_eqp eqp, t_stor_eqp st_eqp,
koown.mv_stor_inf_08 storinf,VIEW_StoreEquipments stEqpView
where rsp.stor_eqp_id = stEqpView.stor_eqp_id
and prt.wo_rspn_id (+)= rsp.wo_rspn_id
and wo.wo_id = rsp.wo_id
ORA-22818: subquery expressions not allowed here
SQL> and st_eqp.stor_eqp_id =rsp.stor_eqp_id
2 and eqp.eqp_id=st_eqp.eqp_id
3 and storinf.stor_id=wo.stor_pty_id
4 and eqp_styp.eqp_styp_id=eqp.eqp_styp_id
and Tom said...
.. subquery expressions not allowed here ...
seems rather self explanatory?
ops$tkyte%ORA11GR2> !oerr ora 22818
22818, 00000, "subquery expressions not allowed here"
// *Cause: An attempt was made to use a subquery expression where these
// are not supported.
// *Action: Rewrite the statement without the subquery expression.
you cannot use a scalar subquery in a materialized view.
http://asktom.oracle.com/pls/asktom/f?p=100:11:3611383881305331::::P11_QUESTION_ID:8363433072800 In your case, it looks like you can just outer join to T_EQP_STYP to pick up the value - it would be more efficient that way in any case. Just join to that table again.
Is this answer out of date? If it is, please let us know via a Comment