             ON fka.constraint_name = fk.constraint_name
            AND fka.table_name = fk.table_name
            AND fka.owner = fk.owner
+          JOIN
+            all_constraints fk2
+            ON fk2.constraint_name = fk.r_constraint_name
+            AND fk2.owner = fk.owner
           JOIN (
             SELECT
               cp.table_name,

        -- count references of referencing tables
        -- > 1 ref = extra delete function
        SELECT
          parent_table,
          owner,
          count(parent_table) AS ref_count,
          max(LEVEL) AS ref_depth
        FROM (
          SELECT

            ON fka.constraint_name = fk.constraint_name
           AND fka.table_name = fk.table_name
           AND fka.owner = fk.owner
          JOIN
            all_constraints fk2
            ON fk2.constraint_name = fk.r_constraint_name
            AND fk2.owner = fk.owner
          JOIN (
            SELECT
              cp.table_name,
