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 |
Show code of a cursor for loop.
What is sqlite used for?
what is data integrity? : Sql dba
What is the best strategy to use COMMIT in a pl/sql loop?
What is out parameter used for eventhough return statement can also be used in pl/sql?
what is the difference between delete and truncate statement in sql? : Sql dba
what are the limitations of identity column? : Transact sql
What is the purpose of normalization?
how do you login to mysql using unix shell? : Sql dba
What are keys in sql?
What mean sql?
Is sql the best database?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)