create or replace procedure pr_selection_Sort(in_arry in varchar2)
is
type one_arr is table of number index by binary_integer;
my_one_arr one_arr;
n_arr_index number(10):=0;
n_min number(10):=0;
n_temp number(10):=0;
n_inner_sel_ind number(10):=0;
begin
for i in (select regexp_substr(in_arry,'[^,]+',1,rownum) my_data from dual
connect by rownum<= length(in_arry) - length(replace(in_arry,',',''))+1)
loop
n_arr_index := n_arr_index +1;
my_one_arr(n_arr_index) := i.my_data;
end loop;
for j in 1..(n_arr_index-1)
loop
n_min := my_one_arr(j);
n_inner_sel_ind := j;
for k in (j+1)..n_arr_index
loop
if n_min>my_one_arr(k) then
n_min := my_one_arr(k);
n_inner_sel_ind := k;
end if;
end loop;
n_temp := my_one_arr(j);
my_one_arr(j) := my_one_arr(n_inner_sel_ind);
my_one_arr(n_inner_sel_ind) := n_temp;
end loop;
for l in 1..n_arr_index
loop
dbms_output.put_line(my_one_arr(l));
end loop;
end;