how can i read write files from pl/sql

Answer Posted / avi007

--Read file

DECLARE
fileHandler UTL_FILE.FILE_TYPE;
BEGIN
fileHandler := UTL_FILE.FOPEN('/tmp', 'myfile', 'R');
UTL_FILE.GETF(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 ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how can we know the count/number of elements of an array? : Sql dba

572


Mention what does plv msg allows you to do?

662


Mention what problem one might face while writing log information to a data-base table in pl/sql?

674


What is having clause in sql?

527


What are the properties of a transaction?

559






Why is sql*loader direct path so fast?

595


How can a function retun more than one value in oracle with proper example?

582


what is the difference between a having clause and a where clause? : Sql dba

517


Where is sql database stored?

518


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

619


Is oracle sql free?

536


What are the advantages of pl sql over sql?

546


Is primary key clustered or nonclustered?

558


How do I view tables in sql developer?

512


Can we update views in sql?

531