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 the first action to perform a query? Suppose I have four tables and five joins and my query is getting slow day by day.
Why do we need databases?
What is a heap in sql?
What is the command used to fetch the first 5 characters of a string?
What is sqlerrm?
What is a rank in sql?
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
what are the disadvantages of mysql? : Sql dba
Write a sql query to convert all character to uppercase after hypen.
What is the primary use of normalization?
What is ROWID?
Do we need commit after truncate?