Hello All,

I am trying to create a materialized view, my subquery consists of a decode function used in with a subquery for expression, search, result and defaults. When I am trying to do this, it is not allowing me to create the Materialized view and thrown the error ORA-22818. Can any body suggest the modifications to the following query, so that I will be able to create a materialized view.

Query is as follows:

c2.circuitname circuitname,
c1.circuitname relatedcircuitname,
from circuit c1, circuit c2,
distinct circoncatenate,
decode((select contbycircuit from circontcir where cirid= cc.cirid),
(select contbycircuit from circontcir a where exists
(select circuitcat from circuit where cirid = a.contbycircuit and circuitcat='SEGMENT')
and cirid = cc.cirid),
(select contbycircuit from circontcir
where cirid= cc.cirid),
(select circoncatenate from circuitconcatenation
where cirid = (select contbycircuit from circontcir
where cirid = cc.cirid))) cirid
from circuitconcatenation cc) x where
c1.cirid=x.circoncatenate and
c2.cirid=x.cirid order by x.cirid;