Home » SQL & PL/SQL » SQL & PL/SQL » UTL_FILE and the root directory
UTL_FILE and the root directory [message #8694] Fri, 19 September 2003 02:15 Go to next message
Gerald
Messages: 54
Registered: January 2001
Member
Dears,

I try to import names of table from a .txt files.
but when i run the script below, i got the success message without any row in my import table ...

I have to say that i run the script from the client
and the .txt file is on the client computer ...
So I don't know what directory the UTL_file is using.
checking the value with show parameter utl_file_dir,
i got the value '*' ... so the current dir ... but from where ? Client or server ?

DROP TABLE clone_imp;
CREATE TABLE clone_IMP (name varchar2(100));
DECLARE
v_file UTL_FILE.FILE_TYPE;
BEGIN
v_file := UTL_FILE.FOPEN('c:','liste_des_tables.txt','R');
FOR i in (SELECT name FROM clone_imp)
LOOP
UTL_FILE.GET_LINE(v_file,i.name);
dbms_output.put
END LOOP;
UTL_FILE.FCLOSE(v_file);
end;
/
select * from clone_IMP;
Re: it's a 'NO_DATA_FOUND' error ... [message #8697 is a reply to message #8694] Fri, 19 September 2003 03:21 Go to previous messageGo to next message
Gerald
Messages: 54
Registered: January 2001
Member
here is the content of my .txt file:
TARIF
TARIF2

And it says 'No_data_found' ... if i put in a buffer the result of :
v_file := UTL_FILE.FOPEN('c:','liste_des_tables.txt','R');
in UTL_FILE.GET_LINE(v_file,buff);
when I do : dbms_output.put_line(buff);
where buff is a variable define in Declare section
as VARCHAR(2) 2048

again it says: 'No_data_found'

Should i put a line terminator ? i'm puzzled :)
regards
G
Re: it's a 'NO_DATA_FOUND' error ... [message #8699 is a reply to message #8694] Fri, 19 September 2003 03:45 Go to previous messageGo to next message
Gerald
Messages: 54
Registered: January 2001
Member
here is the content of my .txt file:
TARIF
TARIF2

And it says 'No_data_found' ... if i put in a buffer the result of :
v_file := UTL_FILE.FOPEN('c:','liste_des_tables.txt','R');
in UTL_FILE.GET_LINE(v_file,buff);
when I do : dbms_output.put_line(buff);
where buff is a variable define in Declare section
as VARCHAR(2) 2048

again it says: 'No_data_found'

Should i put a line terminator ? i'm puzzled :)
regards
G
Re: it's a 'NO_DATA_FOUND' error ... [message #8712 is a reply to message #8697] Fri, 19 September 2003 11:42 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
If the Oracle server is running on another box, the text file will need to be on that box. UTL_FILE cannot read a local (client) file.
Previous Topic: cursor reference out of scope
Next Topic: DB_Link inside Trigger Breaking
Goto Forum:
  


Current Time: Fri Apr 26 09:34:08 CDT 2024