Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: UTL_FILE Utility
Hi,
maybe this is of help ( Oracle 7.3 on NT Server, maybe you have to change the hardcoded file Name)
# enable package UTL_FILE in INIT.ORA
utl_file_dir= %RDBMS73%\\utl_file
show errors;
/
CREATE OR REPLACE PACKAGE BODY Log AS
fmode CHAR(1) := 'a';
retry BOOLEAN := TRUE;
PROCEDURE Init IS
BEGIN
dbms_output.put_line('begin Log.Init'); dbms_output.put_line('fd:' || fd.id ); dbms_output.put_line('end Log.Init');END Init;
PROCEDURE Exit IS
BEGIN
dbms_output.put_line('begin Log.Exit');
dbms_output.put_line('fd:' || fd.id );
utl_file.fclose( fd );
dbms_output.put_line('fd:' || fd.id );
dbms_output.put_line('end Log.Exit');
END Exit;
PROCEDURE put_line ( msg IN VARCHAR2 ) IS
BEGIN
if log = TRUE then
dbms_output.put_line ( msg ); utl_file.put_line ( fd, msg ); if fflush = TRUE then utl_file.fflush ( fd ); end if;
BEGIN -- intialization part
dbms_output.put_line('begin package Log');
WHILE retry = TRUE LOOP
BEGIN -- TRY
retry := FALSE; fd := utl_file.fopen('e:\db\ora\nt\utl_file','utl_file.txt',fmode); EXCEPTION WHEN utl_file.INVALID_OPERATION THEN -- dbms_output.put_line('The file could not be opened or operated on as requested.'); fmode := 'w'; retry := TRUE; WHEN OTHERS THEN -- fehler.handle(SQL_CODE); -- dbms_output.put_line( 'Fehler->' || SQLCODE || ':' ||SQLERRM ); RAISE;
show errors;
/
amerar_at_ci.chi.il.us wrote:
> Hello,
>
> Regarding the utility UTL_FILE.......if I open up a file in Append mode
> and the file does not exist, will Oracle create it or will it give me an
> error?
>
> Arthur
> amerar_at_ci.chi.il.us
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Nov 02 1999 - 12:25:09 CST
![]() |
![]() |