UTL_files [message #361324] |
Tue, 25 November 2008 23:25  |
rajput.anshu
Messages: 45 Registered: October 2008 Location: Bangalore
|
Member |
|
|
I creted a file in C drive named utl_anshu.txt then i write this code in sql*plus prompt
DECLARE
A UTL_FILE.FILE_TYPE;
BEGIN
A:=UTL_FILE.FOPEN('C:\','UTL_ANSHU.TXT','W');
UTL_FILE.PUT_LINE(A,'THIS IS ANSHUMAN SINGH RAJPUT');
FOR AA IN 5..10 LOOP
UTL_FILE.PUTF(A,'THIS IS %S\N',AA);
END LOOP;
UTL_FILE.FCLOSE(A);
END;
After running this program it showing an error.
ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.UTL_FILE", line 120
ORA-06512: at "SYS.UTL_FILE", line 204
ORA-06512: at line 4
what's wrong with that program.
|
|
|
|
|
Re: UTL_files [message #361425 is a reply to message #361327] |
Wed, 26 November 2008 06:19   |
panyam
Messages: 146 Registered: May 2008
|
Senior Member |
|
|
Hi Rajput,
Create a Directory as follow and then try to execute
below block.
SQL> create directory DIR_TEMP as 'C:\';
Directory created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 A UTL_FILE.FILE_TYPE;
3 BEGIN
4 A:=UTL_FILE.FOPEN('DIR_TEMP','error.txt','W');
5 FOR AA IN 5..10 LOOP
6 UTL_FILE.PUTF(A,'THIS IS %S\N',AA);
7 END LOOP;
8 UTL_FILE.FCLOSE(A);
9* end;
SQL> /
PL/SQL procedure successfully completed.
check the file ...it's updated.
|
|
|
Re: UTL_files [message #361446 is a reply to message #361425] |
Wed, 26 November 2008 08:02  |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
panyam wrote on Wed, 26 November 2008 07:19 |
Create a Directory as follow and then try to execute
below block.
SQL> create directory DIR_TEMP as 'C:\';
Directory created.
|
It fixes the problem with using a directory name as opposed to a directory object, however it still doesn't address the root of the problem:
Michel Cadot wrote on Wed, 26 November 2008 00:32 | PL/SQL read on the server not on the client.
|
|
|
|