Home » SQL & PL/SQL » SQL & PL/SQL » newline in utl_file append mode with put
newline in utl_file append mode with put [message #17426] Wed, 12 January 2005 00:43 Go to next message
Rajat Thakur
Messages: 3
Registered: December 2004
Junior Member
hi i have the following code
"

DECLARE
my_file utl_file.file_type;

v_iparam interface_parameter%ROWTYPE;
BEGIN

v_iparam := iface.get_parameter('335');

g.debug_on;

g.DEBUG('param is '||v_iparam.bss_file_location);

my_file := utl_file.fopen(RTRIM(v_iparam.bss_file_location, '/'), 'rth_test.txt', 'w');

utl_file.putf(my_file, 'Rajat and purna testing');

utl_file.fclose(my_file);

my_file := utl_file.fopen(RTRIM(v_iparam.bss_file_location, '/'), 'rth_test.txt', 'a');

utl_file.putf(my_file, 'Rajat and purna putting second line');

utl_file.fclose(my_file);
END;
"

this is creating a file with the following contents

Rajat and purna testing
Rajat and purna putting second line

but i want a file like this
Rajat and purna testing Rajat and purna putting second line

i am using 9i installed on unix and this file is being created on xp.

any ideas?

rgds
rajat
Re: newline in utl_file append mode with put [message #17430 is a reply to message #17426] Wed, 12 January 2005 07:10 Go to previous message
Barbara Boehmer
Messages: 9106
Registered: November 2002
Location: California, USA
Senior Member
If you reopen in append mode, it will append to the next line. If you want to continue on the same line, then don't close and reopen, just eliminate those two lines.

DECLARE
  my_file utl_file.file_type;
  v_iparam interface_parameter%ROWTYPE;
BEGIN
  v_iparam := iface.get_parameter('335');
  g.debug_on;
  g.DEBUG('param is '||v_iparam.bss_file_location);
  my_file := utl_file.fopen(RTRIM(v_iparam.bss_file_location, '/'), 'rth_test.txt', 'w');
  utl_file.putf(my_file, 'Rajat and purna testing');
  utl_file.putf(my_file, 'Rajat and purna putting second line');
  utl_file.fclose(my_file);
END;
/
Previous Topic: Outer joins and NVL function
Next Topic: optimising a query
Goto Forum:
  


Current Time: Sat Aug 09 04:18:53 CDT 2025