declare v_str varchar2(50):='00xxx'; v_char varchar2(1):=null; v_count number(10):=0; begin v_count:=length(v_str); for i in 1..v_count loop begin v_char:=substr(v_str,0,i); dbms_output.put_line(v_char); exception when others then null; end; end loop; end;