title: ORACLE how to print text in a new line
body: <p>Basically its a letter printing in text I'm trying to do via an Oracle PL/SQL Procedure.</p>
  
  <p>My Code below: - </p>
  
  <pre><code>DECLARE
         out_file UTL_FILE.file_type;    lv_file VARCHAR2 (200) DEFAULT TO_CHAR (SYSDATE, 'yyyymmddhhmiss')||'.txt' ;LVSQL varchar2(4000);    lV_TXT varchar2(4000);lv_txt1 varchar2(4000);lv_final_str varchar2(4000); BEGIN    out_file := UTL_FILE.fopen ('SPOOL_DIR', lv_file, 'W');    for i in 1..5 loop
         begin
              select tn,tt into lv_txt,lv_txt1 from 
              (SELECT rownum r, TNAME tn ,TABTYPE tt FROM tab) where r=j;
              lv_final_str:=lV_TXT||chr(9)||lv_txt1||CHR(13);
              utl_file.put_line(Out_file,lv_final_str );
         end;    end loop;
  
         UTL_FILE.fclose (out_file);
      END;
  </code></pre>
  
  <p>I'm able to print the values in next next line by concatenating the lv_final_str with CHR(13) and that I use the  *utl_file.put_line(Out_file,lv_final_str );*  <strong>within the loop</strong></p>
  
  <p>I want to do the same thing by collecting the text in a variable inside the loop.
  and writing the value of the variable outside the loop, using the below code.</p>
  
  <pre><code>DECLARE
     out_file UTL_FILE.file_type;
     lv_file VARCHAR2 (200) DEFAULT TO_CHAR (SYSDATE, 'yyyymmddhhmiss')||'.txt' ;LVSQL varchar2(4000);
     lV_TXT varchar2(4000);lv_txt1 varchar2(4000);tmpvar varchar2(4000);lv_build_str varchar2(4000);lv_final_str varchar2(4000);
  BEGIN
     --SELECT TO_CHAR (SYSDATE, 'yyyymmddhhmiss') INTO lv_file FROM DUAL;
     out_file := UTL_FILE.fopen ('SPOOL_DIR', lv_file, 'W');
     for i in 1..5 loop
         begin
              select tn,tt into lv_txt,lv_txt1 from 
              (SELECT rownum r, TNAME tn ,TABTYPE tt FROM tab) where r=i;
              tmpvar:=lV_TXT||chr(9)||lv_txt1||CHR(13);
              lv_build_str := lv_build_str || chr(9)||tmpvar;
  --            utl_file.put_line(Out_file,lv_final_str );
         end;
     end loop;
     lv_final_str:=lv_build_str;
      utl_file.put_line(Out_file,lv_final_str );
     UTL_FILE.fclose (out_file);
  END;
  </code></pre>
  
  <p>how to do this, please help.
  I used chr(10) as well, it is not printing in new line.
  if you observe chr(9) which is used to print tab space is working well.
  only next line chr(10) or chr(13) is not working. Why...?</p>
  
  <p>any help..
  I'm trying since last 3 days... please help.</p>