     )
   IS
     ddl_command VARCHAR2(500) := 
-      'CREATE OR REPLACE FUNCTION delete_'||table_short_name||'(arr ID_ARRAY) RETURN ID_ARRAY'
+      'CREATE OR REPLACE FUNCTION delete_'||lower(table_short_name)||'(arr ID_ARRAY) RETURN ID_ARRAY'
       ||chr(10)||'IS'
       ||chr(10)||'  deleted_ids ID_ARRAY;'
       ||chr(10)||'BEGIN'

        all_constraints p
        ON p.constraint_name = fk.r_constraint_name
       AND p.owner = fk.owner
      WHERE fk.table_name = upper(tab_name)
        AND fk.owner = upper(schema_name)
        AND fk.constraint_type = 'R'
        AND fk.delete_rule = 'NO ACTION'
    )
    LOOP
      -- create array delete function for parent table

          ON pk.table_name = fk.table_name
         AND pk.owner = fk.owner
         AND pk.column_name = fka.column_name
        WHERE
          fk.table_name = c.table_name
          AND fk.owner = c.owner
          AND fk.constraint_type = 'R'
          AND fk.delete_rule = 'NO ACTION'
          AND pk.position = 1
      ) p
      -- get tables from n:m relationships to cleanup
      -- the FK has to be delete_rule = 'CASCADE' to decide for cleanup
