       parent_block :=
           chr(10)||'  -- delete '||lower(parent_table)
         ||chr(10)||'  IF deleted_id IS NOT NULL THEN'
-        ||chr(10)||'    dummy_id := delete_'||get_short_name(lower(parent_table))||'(deleted_id, 0);'
+        ||chr(10)||'    dummy_id := delete_'||get_short_name(lower(parent_table))||'_post(deleted_id);'
         ||chr(10)||'  END IF;'
         ||chr(10);
     END IF;

        END IF;
      END IF;
    END LOOP;

    IF has_objclass_param THEN
      args := '(pid NUMBER, objclass_id NUMBER := NULL)';
      vars := vars ||chr(10)||'  class_id NUMBER;';
      child_ref_block :=
          chr(10)||'  -- fetch objectclass_id if not set'
        ||chr(10)||'  IF objclass_id IS NULL THEN'
        ||chr(10)||'    SELECT'
        ||chr(10)||'      objectclass_id'
        ||chr(10)||'    INTO'
        ||chr(10)||'      class_id'
        ||chr(10)||'    FROM'
        ||chr(10)||'      '||lower(tab_name)
        ||chr(10)||'    WHERE'
        ||chr(10)||'      id = pid;'
        ||chr(10)||'  ELSE'
        ||chr(10)||'    class_id := objclass_id;'
        ||chr(10)||'  END IF;'
        ||chr(10)
        ||chr(10)||'  IF class_id IS NULL THEN'
        ||chr(10)||'    DBMS_OUTPUT.PUT_LINE(''Objectclass_id unknown! Check OBJECTCLASS table.'');'
        ||chr(10)||'    RETURN NULL;'
        ||chr(10)||'  END IF;'
        ||chr(10)|| child_ref_block;
    ELSE
      args := '(pid NUMBER)';
    END IF;

    RETURN;
  END;

    m_ref_column_name VARCHAR2(30);
    cleanup_m_table VARCHAR2(30);
    objclass ID_ARRAY;
  BEGIN
    ref_cursor := query_ref_fk(tab_name, schema_name);

