7 Replies Latest reply: Feb 21, 2013 9:39 AM by dianap RSS

    Delete in database based on multiselect list values

    dianap
      Hi,

      I have a selectlist in Apex and a function in the database to do some delete based on the selected value from the select list.
      FUNCTION delete_batch (v_batch VARCHAR2) RETURN VARCHAR2
      IS
      BEGIN
      IF v_batch like 'M%'
      THEN
         RETURN ('A monthrun cannot be deleted');
      ELSE
         DELETE FROM so_disco_pa
         WHERE  batch = v_batch
         ;
         DELETE FROM so_batch_pa
         WHERE  batch = v_batch
         ;
         COMMIT;
         RETURN ('Batch '||v_batch||' has been deleted');
      END IF;
      EXCEPTION
      WHEN OTHERS THEN
          RETURN ('Batch could not be deleted');
      END delete_batch;
      The package function is called when the delete button is clicked with following process:
      BEGIN
      DECLARE
      x   varchar2(100);
      BEGIN
      x := pa_control.delete_batch (:P3_BATCH);
      :F105_MESSAGE := x;
      END;
      END;
      Now I want to change the selectlist to a multiselect list so that multiple batches can be deleted.

      How do I change my procedure and process to delete batches based on the selected values?

      Thanks,

      Diana