This is a nice simple example for the code to read data from a text file, and its much more simple than what you posted originally -
http://nimishgarg.blogspot.co.il/2013/04/load-csv-file-in-oracle-using-plsql.html
Here are the relevant pieces of code from the link attached -
Run all of these commands in order to read the file EMP_DEPT.CSV from directory e:\mycsv\ into table emp_dept on user scott (change each of these parameters to fit your design)
// 1. First, create a directory object so oracle can access the file's location
create or replace directory MYCSV as 'e:\mycsv\';
// 2. Grant the user reading from the file privileges on that directory
grant read, write on directory MYCSV to scott;
// 3. Create a table in the same structure as the rows in the file
CREATE TABLE EMP_DEPT
(
EMPNO NUMBER(4),
ENAME VARCHAR2(10),
SAL NUMBER(7,2),
DNAME VARCHAR2(14)
);
// 4. Run this procedure after making the following changes -
// a. Change the variables to match the columns in your destination table
// b. Change the UTL.FILE.FOPEN command to match the directory and file name in your case.
// c. Change every REGEXP_SUBSTR(V_LINE, '[^,]+', 1, 1); to match the variable you want to assign.
// 5. Go for it.
DECLARE
F UTL_FILE.FILE_TYPE;
V_LINE VARCHAR2 (1000);
V_EMPNO NUMBER(4);
V_ENAME VARCHAR2(10);
V_SAL NUMBER(7,2);
V_DNAME VARCHAR2(14);
BEGIN
F := UTL_FILE.FOPEN ('MYCSV', 'EMP_DEPT.CSV', 'R');
IF UTL_FILE.IS_OPEN(F) THEN
LOOP
BEGIN
UTL_FILE.GET_LINE(F, V_LINE, 1000);
IF V_LINE IS NULL THEN
EXIT;
END IF;
V_EMPNO := REGEXP_SUBSTR(V_LINE, '[^,]+', 1, 1);
V_ENAME := REGEXP_SUBSTR(V_LINE, '[^,]+', 1, 2);
V_SAL := REGEXP_SUBSTR(V_LINE, '[^,]+', 1, 3);
V_DNAME := REGEXP_SUBSTR(V_LINE, '[^,]+', 1, 4);
INSERT INTO EMP_DEPT VALUES(V_EMPNO, V_ENAME, V_SAL, V_DNAME);
COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
END IF;
UTL_FILE.FCLOSE(F);
END;
/
Good luck.