Wednesday 13 May 2015

Read Data from text file using UTL_FILE in PL/SQL

Using UTL_FILE you can read the data from text/csv file in PL/SQL. You can follow the below steps to read the data from text file .

Step 1:
Prepare a text file which is delimited by comma (,)








Step 2:
Find the valid UTL directory file path using below script.


Step 3:
Place the text file at server location. The patch would be the valid patch which you get from Step 2.

Step 4:
Write the below PL/SQL block to read the data from text file. You can create procedure also to perform this. (To copy the code select+ctrl+C)


Output:

No comments: