how can i read write files from pl/sql
Answers were Sorted based on User's Feedback
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 |
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 |
What is row_number () in sql?
What is the difference between an inner and outer join?
how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba
What is Raise_application_error ?
Is a view faster than a stored procedure?
How to generate a salary slip like jan 1000 1000 feb 1000 2000 ... dec 1000 12000
What is the order of sql select?
Is a table valued function object?
How can we avoid duplicating records in a query?
How do you write an inner join query?
how to calculate expressions with sql statements? : Sql dba
HOW TO APPEAR FOR ONLINE EXAMS OF SQL & PL/SQL? WHICH BOOKS WILL BE BETTER FOR REFERENCE TO QUALIFY THESE EXAMS? ARE THERE ANY MODEL PAPERS AVAILABLE IN THE MARKET ABOUT SQL & PLSQL?