Hi Christ,

you are absolutely right, there is something wrong with the outer join because the original query try to make up null in line_class3.line_class_id (+) and then later in sub (EXISTS) is asking for line_class_id = 467
It is a same for plan_cell4.plan_id (+) . I just read an article about outer join (Tomkyte), so I do agree with you.
moreover, the query ets a millions of rows then group y, order that would take a long time on that.

another thing that I did not see is the CASE and excluding records where the PLAN_ID = -1 .

I appreciate your help , I am gonna rewrite this query (actually, the original query is from a third party software and I cannot tell you about location...)

Thanks a lot