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

Is sql a scripting language?

608


Can a composite key be null?

617


How do I order by ascending in sql?

638


What is sql lookup?

590


What are the sql commands?

695






Can we rollback after truncate?

660


What is sql query limit?

611


How do I run a pl sql procedure in sql developer?

596


When can we use the where clause and the having clause?

664


Why do we use sql constraints?

749


How do you define a foreign key?

624


Show the cursor attributes of pl/sql.

701


What is union, minus and interact commands?

849


How much does sqlite cost?

633


What is the file extension for sql database?

594