If you get stuck with subquery factoring (WITH) or inline views, you could wrap the whole lot in a table function, and query that instead -- Connor McDonald =========================== email: connor_mcdonald@xxxxxxxxx web: http://www.oracledba.co.uk "Semper in excremento, sole profundum qui variat"