declare type vc is table of varchar2(3000) index by Binary_integer; v_count_tel number; v_tele vc; cursor cc is select telephone from xx_pun_cc_stg; num_company_rows BINARY_INTEGER := 0; begin num_company_rows := num_company_rows + 1 FOR v_count_tel IN 1..25 LOOP select REPLACE(i.TELEPHONE,SUBSTR(i.TELEPHONE,v_count_tel,1), DECODE(SUBSTR(i.TELEPHONE,v_count_tel,1), '0','0','1','1','2','2','3','3','4','4','5','5','6','6','7','7','8','8','9','9','X')) into v_tele(num_company_rows) from xx_pun_cc_stg; dbms_output.put_line(v_tele(num_company_rows)); End LOOP; end loop; end;