Friends, once again I need help, I need to read a particular .csv file ... Read and save in table
] I found a post on the net, I am trying to adjust it in my application, as a test, I am using the names of the columns equal to the example, to facilitate ... but it is not working, speaks that the path of the file is not found .. .
See the code
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 ('D:\', 'LIC_TESTE.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 LIC_TESTE 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;
The names of the fields and columns are equal to the example
I put the spreadsheet at the root of the drive "D"
I already made several attempts with the Name of the way, however, no one works
I am using the Apex Oracle 19
I created a button, with a dynamic action, in the Run PL / SQL code
could help me make this code work? appreciate