UTL_FILE_DIR [message #73346] |
Wed, 31 March 2004 04:07 |
Milly
Messages: 72 Registered: March 2004
|
Member |
|
|
Hi!
I have a problem: I have to use the utl_file and I need to modify the init.ora to permit the write operation, but...:
ALTER SYSTEM SET UTL_FILE_DIR= scope=spfile
*
ERRORE alla riga 1:
ORA-02095: Specified initialization parameter cannot be modified
How can I resolve this problem?
thanks!!
|
|
|
Re: UTL_FILE_DIR [message #73347 is a reply to message #73346] |
Wed, 31 March 2004 06:36 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
are you using a 9i database?
in 9i UTL_FILE is obsolete.
you have to create a directory.
this may help you...
-- notes:
-- 1. Stored Procedure to write the log files for the Lawson_etl process
-- 2. Takees 3 input parameters -> filename, message to be written and Mode (read or write)
-- in which the log file is opened.
-- Output -> written to OS file.
-- 3. init parameter utl_file_dir = c:report (in 8i) or
create an oracle directory using create directory (9i) and file permsisions are given -->look docs
-- 4. The Most common exceptions are handled, will add any more.
-- 5. Initally the file is to be opened in Write mode ( to write the timestamp)
-- If you want to append data into the same file open the file in apppend mode.
-- WHO= rajendran
CREATE OR REPLACE PROCEDURE write_log
(
fname IN VARCHAR2 ,
message IN VARCHAR2 ,
mo IN VARCHAR2
)
IS
log_file UTL_FILE.FILE_TYPE; -- file handle for the log file
BEGIN
log_file := UTL_FILE.FOPEN('c:report',fname,mo);
UTL_FILE.PUTF(log_file,'%sn',message);
UTL_FILE.FCLOSE(log_file);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('no_data_found');
WHEN UTL_FILE.INVALID_PATH THEN
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
WHEN UTL_FILE.WRITE_ERROR THEN
DBMS_OUTPUT.PUT_LINE('UTL_FILE.WRITE_ERROR');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('other stuff');
END;
/
-------------------------------------------------------------------------------------------------------------------------
-- USAGE
-------------------------------------------------------------------------------------------------------------------------
SQL> ed
Wrote file afiedt.buf
1 begin
2 write_log('sampelfile.txt','hello world!','W');
3 write_log('sampelfile.txt','hello world again!','A');
4* end;
SQL> /
PL/SQL procedure successfully completed.
SQL> get c:reportsampelfile.txt
1 hello world!
2* hello world again!
SQL>
[Updated on: Sun, 18 December 2005 08:48] Report message to a moderator
|
|
|
|
|
Re: UTL_FILE_DIR [message #73351 is a reply to message #73350] |
Wed, 31 March 2004 23:34 |
Milly
Messages: 72 Registered: March 2004
|
Member |
|
|
I've tried to do it...but oracle raises the error I've showed....
now I'm trying in oracle 9, creating a directory....adn so....but I've the same problem qith the invalid path....acc...acc..
|
|
|
|
Re: UTL_FILE_DIR [message #73353 is a reply to message #73352] |
Thu, 01 April 2004 00:19 |
Milly
Messages: 72 Registered: March 2004
|
Member |
|
|
I have to export data table in a flat file, in a directory not necessarly on the server.
I can't edit the init.ora file....the goal is to do this on a client....
with the utl_file I can't do it (because this works on the server)
with spool I copy the entire statement and not only the data....
any idea?
|
|
|
|
|
|
|
|
|