Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can one read/write files from PL/SQL?

files PL read sql write
0
Posted

Can one read/write files from PL/SQL?

0

Included in Oracle 7.3 is a UTL_FILE package that can read and write files. The directory you intend writing to has to be in your INIT.ORA file (see UTL_FILE_DIR=… parameter). Before Oracle 7.3 the only means of writing a file was to use DBMS_OUTPUT with the SQL*Plus SPOOL command. DECLARE fileHandler UTL_FILE.FILE_TYPE; BEGIN fileHandler := UTL_FILE.FOPEN(‘/home/oracle/tmp’, ‘myoutput’,’W’); UTL_FILE.PUTF(fileHandler, ‘Value of func1 is %s\n’, func1(1)); UTL_FILE.

0

The UTL_FILE database package can be used to read and write operating system files. A DBA user needs to grant you access to read from/ write to a specific directory before using this package.

0

Ans – Included in Oracle 7.3 is a UTL_FILE package that can read and write files. The directory you intend writing to has to be in your INIT.ORA file (see UTL_FILE_DIR=… parameter). Before Oracle 7.3 the only means of writing a file was to use DBMS_OUTPUT with the SQL*Plus SPOOL command. DECLARE fileHandler UTL_FILE.FILE_TYPE; BEGIN fileHandler := UTL_FILE.FOPEN(‘/home/oracle/tmp’, ‘myoutput’, ‘W’); UTL_FILE.PUTF(fileHandler, ‘Value of func1 is %s\n’, func1(1)); UTL_FILE.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.