Home » SQL & PL/SQL » SQL & PL/SQL » Utl__File
Utl__File [message #274328] Mon, 15 October 2007 10:44 Go to next message
Upperm
Messages: 95
Registered: July 2003
Member
Hello folks,
The aim of the bellow script is to copy the content of the first text file "FIC_IN.TXT" into the second text file "FIC_OUT.txt".
But I do receive the following message error:
" SP2-0552: Variable de lien "UTL_FILE" non declarée."
What could be the cause of the problem?
.. Thankful for any help.


================ Script: =================

DECLARE
v_dir_in varchar2(55) ;
v_dir_out varchar2(55) ;

v_fic_in varchar2(128);
v_fic_out varchar2(128);

p_fic_in utl_file.file_type;
p_fic_out utl_file.file_type;

v_ligne varchar2(32767);

BEGIN
v_dir_in:='Fichiers_in'; v_dir_out:='fichiers_out';
v_fic_in:='fic_in.txt'; v_fic_out:='fic_out.txt';

p_fic_in:=utl_file.fopen(v_dir_in,v_fic_in,'R',32764) ;
p_fic_out:utl_file.fopen(v_dir_out,v_fic_out,'W',32764);

loop
utl_file.get_line(p_fic_in,v_ligne);
utl_file.putl_line(p_fic_out,v_ligne);
End loop;

utl_file.fclose_all;
END;
/
=========== End of the Script ==================

Re: Utl__File [message #274332 is a reply to message #274328] Mon, 15 October 2007 10:59 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).

Line XX a "=" sign is missing.

Regards
Michel
Re: Utl__File [message #274339 is a reply to message #274328] Mon, 15 October 2007 11:51 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
Upperm wrote on Mon, 15 October 2007 11:44


loop
utl_file.get_line(p_fic_in,v_ligne);
utl_file.putl_line(p_fic_out,v_ligne);
End loop;



Endless loop.
Re: Utl__File [message #274342 is a reply to message #274339] Mon, 15 October 2007 12:09 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Not really, an exception is raised at the end of the file in.

Regards
Michel
Re: Utl__File [message #274357 is a reply to message #274342] Mon, 15 October 2007 15:24 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
Oh, ugh.
I guess I meant to say
 utl_file.putl_line(p_fic_out,v_ligne);

is invalid. Yeah, that's it.
Previous Topic: data architecture question about indexes for foreign keys
Next Topic: Help with storing Hierarchical data using Nested Intervals and Matrix Encoding
Goto Forum:
  


Current Time: Fri Dec 02 16:27:27 CST 2016

Total time taken to generate the page: 0.52124 seconds