     post_block := post_block || delete_parent_by_ids(tab_name, schema_name);
 
     -- create dummy variable if pre or post block are not null
-    IF pre_block <> '' OR post_block <> '' THEN
-      declare_block := declare_block ||chr(10)||'  dummy_ids ID_ARRAY';
+    IF pre_block IS NOT NULL OR post_block IS NOT NULL THEN
+      declare_block := declare_block ||chr(10)||'  dummy_ids ID_ARRAY;';
     END IF;
 
     -- putting all together

        chr(10)||'  -- delete referenced parts'
      ||chr(10)||'  SELECT'
      ||chr(10)||'    id'
      ||chr(10)||'  FROM'
      ||chr(10)||'    '||tab_name
      ||chr(10)||'  WHERE'
      ||chr(10)||'    '||lower(a.column_name)||' = pid'
      ||chr(10)||'    AND id != pid'
      ||chr(10)||'  BULK COLLECT INTO'
      ||chr(10)||'    '||tab_name||'_ids;'
      ||chr(10)
      ||chr(10)||'  dummy_ids := delete_'||tab_short_name||'('||tab_name||'_ids);'
      ||chr(10), '')  WITHIN GROUP (ORDER BY a.column_id)
    INTO
      self_block

  IS
  BEGIN
    RETURN
        chr(10)||'  -- delete '||lower(tab_name)||'s'
      ||chr(10)||'  DELETE FROM'
      ||chr(10)||'    '||lower(tab_name)
      ||chr(10)||'  WHERE'
      ||chr(10)||'    '||lower(fk_column_name)||' = pid;'
      ||chr(10);
  END;

