Quick & Dirty: Populate number array from string.

Here is a quick way to convert a list of colon separated numbers into a number array:

declare 
  l_list_of_numbers varchar2(32767) := '1:2:3'; 
  l_string_array apex_application_global.vc_arr2; 
  l_number_array apex_application_global.n_arr; 
begin 
  l_string_array := apex_util.string_to_table(l_list_of_numbers); 
  select * bulk collect 
  into   l_number_array 
  from   table(l_string_array); 
   
  for idx in 1..l_number_array.count 
  loop 
    dbms_output.put_line(l_number_array(idx)); 
  end loop; 
end; 

 

Leave a Reply

Your email address will not be published. Required fields are marked *