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

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL FILE I/O

Re: PL/SQL FILE I/O

From: Martin Spek <MSPEK_at_nl.oracle.com>
Date: Wed, 05 Apr 2000 12:22:45 +0200
Message-ID: <38EB13F5.D1F2D33D@nl.oracle.com>


Preveen

You have to specify the parameter utl_file_dir in your init.ora file. This parameter indicates the directories that are permitted for PL/SQL file IO

Praveen Shettigar wrote:
>
> Hello,
>
> I am trying to write a PL/SQL program that will read the input data from a file and insert tuples
> into tables.
>
>
> My code :--
>
> set serveroutput on
> clear buffer;
>
> DECLARE
> --I/O Variables
> in_file_handle utl_file.file_type;
> out_file_handle utl_file.file_type;
> file_path varchar2(80) := '/home/grads/shettiga/ins';
> in_file_name varchar2(40) := 'insert.txt';
> out_file_name varchar2(40) := 'output.txt';
>
> BEGIN
>
> dbms_output.enable(30000);
> dbms_output.put_line('begin the program now:');
> dbms_output.new_line;
>
> in_file_handle := utl_file.fopen(file_path, in_file_name, 'r');
>
> dbms_output.put_line ('Now the input file has been opened');
>
> out_file_handle := utl_file.fopen(file_path, out_file_name, 'a');
> dbms_output.put_line ('Output file has been opened');
>
>
>
> EXCEPTION
> WHEN no_data_found THEN
> dbms_output.put_line('END OF FILE REACHED');
>
> WHEN utl_file.invalid_path THEN
> dbms_output.put_line('INVALID PATH');
>
> WHEN OTHERS THEN
> begin
> ROLLBACK;
> dbms_output.put_line('Something Wrong. TERMINATING....');
> end;
>
> END;
> /
>
> After running the program
> the output -
>
> begin the program now:
> INVALID PATH
>
> I checked the file name and the file location and i found that they represent a legal filename on
> the system, and the directory is also accessible.
> Then why i am getting such an error??
>
> thankyou
> Praveen

--


Martin Spek      
Database Administrator            tel:    +31 30 6699572

Received on Wed Apr 05 2000 - 05:22:45 CDT

Original text of this message

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