Search code examples
oracleoracle-apexlov

Select list oracle apex second value


When I create a Select list based on a SQL query it asks for 2 columns. For example I did something like: select itemcode, itemname from items in a select list called LST_ITEMS. I need to retrieve or get both of the values when I call it with :LST_ITEMS.


Solution

  • You can write query as:

    select itemname display_value, 
           itemcode || ':' || itemname return_value
      from items
    

    After that you will get combined value in :LST_ITEMS variable. You can parse it in PL/SQL code further. For example:

    declare
       code number;
       name varchar2(100);
    begin
       code = substr(:LST_ITEMS, 1, instr(:LST_ITEMS, ':') - 1);
       name = substr(:LST_ITEMS, instr(:LST_ITEMS, ':') + 1);
    end;