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

Home -> Community -> Usenet -> c.d.o.server -> Re: utl_file

Re: utl_file

From: Pete Finnigan <pete_at_peterfinnigan.demon.co.uk>
Date: Mon, 17 Sep 2001 17:37:51 +0100
Message-ID: <YdrjPKAfbip7Ewfc@peterfinnigan.demon.co.uk>


Hi

First of all add an exception handler to find out the real error and then you may have A chance to fix it

use

exception

        when no_data_found then
                dbms_output.put_line('No data found');
        when value_error then
                dbms_output.put_line('value error');
                raise_application_error(-20100,'file error');   
        when utl_file.invalid_path  then
                dbms_output.put_line('invalid path');
                raise_application_error(-20100,'file error');   
        when utl_file.invalid_mode  then
                dbms_output.put_line('invalid_mode');
                raise_application_error(-20100,'file error');   
        when utl_file.invalid_filehandle  then
                dbms_output.put_line('invalid_filehandle');
                raise_application_error(-20100,'file error');   
        when utl_file.invalid_operation  then
                dbms_output.put_line('invalid_operation');
                raise_application_error(-20100,'file error');   
        when utl_file.read_error  then
                dbms_output.put_line('read_error');
                raise_application_error(-20100,'file error');   
        when utl_file.write_error  then
                dbms_output.put_line('write_error');
                raise_application_error(-20100,'file error');   
        when utl_file.internal_error  then
                dbms_output.put_line('internal_error');
                raise_application_error(-20100,'file error');   
        when others then
                dbms_output.put_line('un-handled');
                raise_application_error(-20100,'file error');   

And set serveroutput on before running

Also i would not advise setting utl_file_dir to '*' as this is a very bad security risk. This would allow anyone to use utl_file to then read trace files that exist in the user_dump_dest. It is possible to dump the library_cache to trace including clear text passwords if any users have been added or changed and the SQL is still in the library cache.

HTH Pete Finnigan
www.pentest-limited.com

In article <9o4nls$1i3h$1_at_as201.hinet.hr>, Goran Sokol <goran.sokol_at_zaba.hr> writes
>Hi!
>
>I have some problems with utl_file package on 7.3.3 for AIX (utl_file_dir in
>init oracle_sid.ora is setup to *).
>
>SQL> r
> 1 declare
> 2 han UTL_FILE.FILE_TYPE;
> 3 loc constant varchar2(20) := '/vendor/';
> 4 fne constant varchar2(20) := 'proba.txt';
> 5 begin
> 6 han := utl_file.fopen(loc, fne, 'w');
> 7 utl_file.put_line(han, 'bla bla');
> 8 utl_file.fclose(han);
> 9* end;
>declare
>*
>ERROR at line 1:
>ORA-06510: PL/SQL: unhandled user-defined exception
>ORA-06512: at "SYS.UTL_FILE", line 85
>ORA-06512: at "SYS.UTL_FILE", line 120
>ORA-06512: at line 6
>
>
>Any ideas?
>
>Goran
>
>
>

-- 
Pete Finnigan
IT Security Consultant
PenTest Limited

Office  01565 830 990
Fax     01565 830 889
Mobile  07974 087 885

pete.finnigan_at_pentest-limited.com

www.pentest-limited.com
Received on Mon Sep 17 2001 - 11:37:51 CDT

Original text of this message

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