Write to a file in PL/SQL without spools or utl_file

1.1k views Asked by At

Trying to create an output file through a procedure but am unable to modify the init.ora to allow for utl_file_dir or create directory. Is there another way to accomplish this without creating a table and doing a simple spool, this unfortunately, is out the question, too.

2

There are 2 answers

1
Patrick Hofman On BEST ANSWER

No. You will need access to init.ora to get this done the nice way through Oracle.

The only other option I can think of is the use of a Java procedure to do the file writing. I couldn't find any special requirements you need to have set to use that. Read up on the subject here.

2
kayakpim On

If you have access to sqlplus then add dbms_output.put_line messages to the code and run it in sqlplus. Before running type:

spool <filename you want>

then

spool off 

to close the file and stop writing.

Either that or using Java could be an option but you will need additional privileges to access the file system and compile a java method on the db.

You should really be given access to a directory on the filesystem. Speak to a dba and if there is a business requirement you should be able to make it happen.