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

What is the first action to perform a query? Suppose I have four tables and five joins and my query is getting slow day by day.

4 Answers   Hexaware,


Why do we need databases?

0 Answers  


What is a heap in sql?

0 Answers  


What is the command used to fetch the first 5 characters of a string?

0 Answers  


What is sqlerrm?

0 Answers  






What is a rank in sql?

0 Answers  


I have one Excel file with 1,50,000 Records. Now I need to load that whole file into Oracle Database with same columns in Excel sheet . I need PLSQL Procedure or used by SQL PLUS

7 Answers   Polaris,


what are the disadvantages of mysql? : Sql dba

0 Answers  


Write a sql query to convert all character to uppercase after hypen.

0 Answers  


What is the primary use of normalization?

0 Answers  


What is ROWID?

8 Answers  


Do we need commit after truncate?

0 Answers  


Categories