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

What is full join?

517


what is the difference between delete and truncate statement in sql? : Sql dba

539


How can use stored procedures in sql?

573


Which is faster union or join?

487


Mention what does the hierarchical profiler does?

553






What is the maximum number of rows in sql table?

536


Is it possible to sort a column using a column alias?

599


What is sqlexception in java?

542


What is nosql db?

532


How to start oracle sql developer?

552


what is the difference between char and varchar data types? : Sql dba

528


Which is faster view or stored procedure?

496


What is the benefit of foreign key?

522


Write a sql select query that only returns each name only once from a table?

558


Does access use sql?

551