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 natural join and inner join same?

502


How do I quit sql?

503


how to get a list of columns in an existing table? : Sql dba

546


Why cross join is used?

637


What are primary key and foreign key and how they work?

556






What is sql deadlock?

568


What is pls_integer in pl sql?

545


What is mutating table error?

666


What is sql trigger example?

543


What is a pragma statement?

723


Do foreign keys improve performance?

550


What is function and procedure in pl sql?

523


What is a clob in sql?

569


Show code of a cursor for loop.

584


What is sql prepared statement?

548