how can i read write files from pl/sql

Answers were Sorted based on User's Feedback



how can i read write files from pl/sql..

Answer / deepak singh

throug the Text_io package

Is This Answer Correct ?    2 Yes 0 No

how can i read write files from pl/sql..

Answer / 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

how can i read write files from pl/sql..

Answer / 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

More SQL PLSQL Interview Questions

How do I quit sql?

0 Answers  


What is the difference between mdf and ndf files?

0 Answers  


Is sqlexception checked or unchecked?

0 Answers  


Which tcp/ip port does sql server run?

0 Answers  


Are pl sql variables case sensitive?

0 Answers  






How many sql core licenses do I need?

0 Answers  


How to fetch records from a partitioned table?

2 Answers   HSBC,


How do you display "13th of November, 17 days left for month end" without hardcoding the date.

3 Answers  


How to write a single statement that concatenates the words ?hello? And ?world? And assign it in a variable named greeting?

0 Answers  


How do I save the results of sql query in a file?

0 Answers  


How to get second highest salary from a table

3 Answers  


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

0 Answers  


Categories