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

Home -> Community -> Usenet -> c.d.o.tools -> Re: UTL_FILE Problem

Re: UTL_FILE Problem

From: Michiel Kuperus <cube_at_dds.nl>
Date: Wed, 23 Aug 2000 14:00:21 +0200
Message-ID: <0E16861EE7BCD111BE9400805FE6841F11B6BC6E@c1s5x001.cor.srvfarm.origin-it.com>

Christian,

some tips:

>filehand := UTL_FILE.FOPEN ('C:\Daten\Output\', 'test1.txt'); -- The
problem seems to be to open the file
is wrong, you need to specify R or W :
filehand := UTL_FILE.FOPEN ('C:\Daten\Output\', 'test1.txt','W');

And, it will be saved on the Oracle server (wherever that may be), where you also need enough rights to write...

the first argument is the directory, without the '\' at the end (eg. '/app/oracle/dump' ) if the server is NT/2000 try leaving the 'C:\' thing

regards,
Michiel

Christian Kurz wrote in message <8ntshr$2u7q$1_at_www.univie.ac.at>...
>Hi!
>
>I want to create textfiles stored on my local computer. The should contain
>various data from my Oracle 8 Database. But it wont work and I dont know
>why. I would be thankfull for any suggestions. The path exists on my local
>Win2000 machine.
>
>Thanks
>
>Christian
>
>SQL> ru
> 1 DECLARE
> 2 TYPE GenericCurTyp IS REF CURSOR;
> 3 c1 GenericCurTyp;
> 4 sess_rec stat_tab%ROWTYPE;
> 5 value NUMBER;
> 6 cumpercent NUMBER;
> 7 filehand UTL_FILE.FILE_TYPE;
> 8 buffer VARCHAR2 (100);
> 9 BEGIN
> 10 filehand := UTL_FILE.FOPEN ('C:\Daten\Output\', 'test1.txt',
>); -- The problem seems to be to open the file
> 11 OPEN c1 FOR
> 12 SELECT * FROM stat_tab ORDER BY value;
> 13 LOOP
> 14 FETCH c1 INTO sess_rec;
> 15 EXIT WHEN c1%NOTFOUND;
> 16 value := .....
> 17 cumpercent := .....
> 18 buffer := to_char(value) || ' ' ||
>to_char(cumpercent);
> 19 UTL_FILE.PUT_LINE (filehand, buffer);
> 20 END LOOP;
> 21 CLOSE c1;
> 22 UTL_FILE.FCLOSE (filehand);
> 23 COMMIT;
> 24* END;
>DECLARE
>*
>ERROR at line 1:
>ORA-06510: PL/SQL: unhandled user-defined exception
>ORA-06512: at "SYS.UTL_FILE", line 98
>ORA-06512: at "SYS.UTL_FILE", line 157
>ORA-06512: at line 10
>
>
Received on Wed Aug 23 2000 - 07:00:21 CDT

Original text of this message

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