2
votes

I'm using Oracle Application Express version 4.1.1.00.23 if that's relevant.

I've tried this:

DECLARE
   l_selected       APEX_APPLICATION_GLOBAL.VC_ARR2;
BEGIN
   l_selected := APEX_UTIL.STRING_TO_TABLE (:P12_SL_SALES_CHANNEL);

   FOR i IN 1 .. l_selected.COUNT
   LOOP

      INSERT INTO xxapex_aap_data (sales_channel_1))
           VALUES (l_selected(i));

   END LOOP;

EXCEPTION
   WHEN OTHERS
   THEN
      RAISE_APPLICATION_ERROR (-20000, SQLERRM);
END;

And I always end up with only the last value from the list inserted into the table.

1
What sort of item are you using? What is the value when submitting? It should be values concatenated by colons. (and btw, yes, apex version is usually relevant, so a good thing you added this) - Tom
i use a simple SelectList with an LOV on a view. The concatenated values is what i expect and i'am wondering why it's only one value(the last value that i select). - Tim
But you have set your select list to allow multiple selection? - Tom
Honestly, can't really say. 4.1 isn't fresh in my memory anymore and I don't have instant access to an environment at the moment. I've checked on 4.2.6.00.03 and it works there. Maybe add in some debug lines just for verification. - Tom
Ok Tom, i will do it. But thanks for your help! - Tim

1 Answers

0
votes

the best guess is that the :P12_SL_SALES_CHANNEL contains a string that isn't parsed correctly. I would debug by adding raising an application error that checks the values of :P12_SL_SALES_CHANNEL and l_selected.COUNT, and of corse check the separator (default is ':')

https://docs.oracle.com/database/apex-5.1/AEAPI/STRING_TO_TABLE-Function.htm#AEAPI185