Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: utl_file and hex:00

Re: utl_file and hex:00

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 22 Sep 1999 20:22:55 -0400
Message-ID: <RHLpNycJVx6rJUQa7q9uL7Ujf9ci@4ax.com>


A copy of this was sent to "Andrew Johnson" <camicro_at_nbnet.nb.ca> (if that email address didn't require changing) On Wed, 22 Sep 1999 14:43:18 -0700, you wrote:

>Has anybody successfully written hex:00 to a flat file using utl_file. I
>have already written the required function to go from hex to characters,
>etc.... but I can't get past the problem of writing out a nul value that
>actually takes up a byte of space on the flat file. Any help would be
>greatly appreciated
>
>thanks - Andrew J johnson_aj1_at_yahoo.com
>

tkyte_at_8i> declare

  2          l_output                utl_file.file_type;
  3  begin
  4          l_output := utl_file.fopen( '/tmp', 'test.dat', 'w' );
  5          utl_file.put_line( l_output, 'a' || chr(0) || 'a' );
  6          utl_file.fclose( l_output );
  7 end;
  8 /

PL/SQL procedure successfully completed.

tkyte_at_8i>
tkyte_at_8i> !od -c /tmp/test.dat
0000000 a \0 a \n
0000004

although utl_file is designed to write TEXT -- not special characters. strange things might occur when trying to write binary files with utl_file.

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Sep 22 1999 - 19:22:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US