Loading Multiple CSV Files into Oracle DB
Okay here is my problem...
I have multiple csv files with data in each file. They are connected via foreign keys (with each table having its on primary key). I want to load these tables into an Oracle database using SQL or any other method u can think of. I know the order in which the tables should be loaded so do i go about loading the tables into the Oracle db.
E.g.
// CSV 1
Fields = ID_NUMBER | Name | Date
Data = 12345 (PK)| Hafiz | 12-12-2008 |
// CSV2
Field = ID_PRODUCT_ NUMBER | ID_NUMBER | Colour | Type
Data = 54321 (PK) | 12345 (FK) | Black| Car |
// Oracle Table 1
Fields = ID_NUMBER | Name | Date
Data = BLANK
// Oracle Table 2
Field = ID_PRODUCT_ NUMBER | ID_NUMBER | Colour | Type
Data = BLANK
The Oracle DB has the tables setup with the same field name. I want to load CSV 1 first into Oracle Table 1 and then CSV 2 into Oracle Table 2 (must be in this order or will run into referential integrity issues).
The next step is to make the solution applicable to csv files with 100 lines of data each (probably using some sort of iterative process). I've tried using SQL Loader but haven't had much luck. Can someone help??????????
|