how can i read write files from pl/sql

Answer Posted / avi007

DECLARE
fileHandler UTL_FILE.FILE_TYPE;
BEGIN
fileHandler := UTL_FILE.FOPEN('/tmp', 'myfile', 'W');
UTL_FILE.PUTF(fileHandler, 'Look ma, I''m writing to a
file!!!\n');
UTL_FILE.FCLOSE(fileHandler);
EXCEPTION
WHEN utl_file.invalid_path THEN
raise_application_error(-20000, 'ERROR:
Invalid path
for file or path not in INIT.ORA.');
END;
/

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why primary key is required?

717


what is the difference between primary key and unique key? : Sql dba

703


What is a pdo connection?

681


What are the disadvantages of not performing database normalization?

805


Explain the purpose of %type and %rowtype data types?

662






What is the purpose of design view?

724


What is sp_helptext?

770


Is left join same as join?

727


What are local and global variables and their differences?

804


How to connect a sql*plus session to an oracle server?

819


What are the various levels of constraints?

853


What is field delimiter?

792


Can you join a table to itself?

710


How many types of index are there?

723


What is the advantage of nosql?

730