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 |
Can we create foreign key without primary key?
What are the topics in pl sql?
what happens if null values are involved in expressions? : Sql dba
Can I learn sql in a week?
What is data types in sql?
How to use sql statements in pl/sql?
What is a package ? What are the advantages of packages ?
Can we use distinct and group by together?
What is ttitle and btitle?
What is a table in a database?
What are the difference between Functions/Stored Procs and Triggers and where are they used.
how to write date and time literals? : Sql dba