This content has been marked as final. Show 4 replies
Use TEXT_IO or CLIENT_TEXT_IO to read the file. For each line in the file, cut it into pieces using SUBSTR, then issue an insert into your table.1 person found this helpful
Search the forum, there are lots of examples on TEXT_IO.
thanks andreas , i am trying to do so , but the problem is
substr is used like so :
substr(12345678,0,3) , so the result is '123' , but in this example i know the number in front of me , i know that it comprises of 8 digits , but
in the csv file , the situation is different , the lines are saved like so :
and there is a comma between all words(fields) , then how to cut only the first field to the first "," , then the second field to the second "," and so on ?
You can use INSTR to find the position of the next comma.
You can also use the DBMS_UTILITY.COMMA_TO_TABLE Procedures to convert each row into a table and then iterate through the table to access each field.
In particular this signature
Where lname_array is defined as
DBMS_UTILITY.COMMA_TO_TABLE ( list IN VARCHAR2, tablen OUT BINARY_INTEGER, tab OUT lname_array);
TYPE lname_array IS TABLE OF VARCHAR2(4000) index by BINARY_INTEGER;