Search code examples
plsqloracle11gprocedure

Insert values from a ListManager Oracle Apex


I have a table Aux_Nac which is represented on the form Students by a List Manager item. Their connection: Students -|-----< [Aux_Nac] >------|- Nationalities. I know that PXX_LISTMANAGER has something ike this saved: 'A:B:C:D:Z:P:Y', but how do I take it out and record it?


Solution

    1. create a procedure which Point is Processing and Server side condition Type is Request is contained in Value, below write CREATE
    2. Alter this code and copy it and past in the procedure's code:

      DECLARE
         l_nat nationalities.nome%type;
         l_remainings varchar2(500);
         l_pos number := 0;
      BEGIN
        l_remainings := :P27_nationalities || ':';
        WHILE INSTR(l_remainings, ':') > 0
        LOOP
          l_pos := INSTR(l_remainings, ':');
          l_nat := SUBSTR(l_remainings, 0, l_pos - 1);
          l_remainings := SUBSTR(l_remainings, l_pos + 1, LENGTH(l_remainings));
          INSERT INTO AUX_NAC (nationalities_id
                              ,students_id)
          VALUES ((SELECT nc.id_nc FROM nationalities nc WHERE nc.name = l_nat)
                 ,:P27_ID);
        END LOOP;
      

      END;