Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

utl_file.utl_raw adds a line feed at the end of the line. How to avoid it.

670117Nov 14 2008 — edited Dec 8 2008
utl_file.utl_raw adds a line feed at the end of the line. I have to send some binary files to my vendor and they do not want a line feed at the end of the line.
When I execute the sample program below, it creates a file with a line feed(chr(10)) at the end of the line. When I do dump in hexa, it shows a character x0A
How to avoid the line feed at end of line?

We are using Oracle 9i on unix platform.

declare
l_output utl_file.file_type;
v_raw raw(32767);
v_trlr_rec_code VARCHAR2(2);
v_trlr_evnt_title VARCHAR2(6);

begin
l_output := utl_file.fopen( 'RM_MHE_IN_DIR', 'abc.dat', 'w', 14 );
v_trlr_rec_code := '99';
v_trlr_evnt_title := 'STARTD';

v_raw := HEXTORAW(v_trlr_rec_code) || utl_raw.cast_to_raw(v_trlr_evnt_title);

utl_file.put_raw( l_output, v_raw );
utl_file.fflush( l_output );
utl_file.fclose( l_output );
dbms_output.put_line( utl_raw.cast_to_varchar2( v_raw ) );
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( sqlerrm );
end;
/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 5 2009
Added on Nov 14 2008
4 comments
1,876 views