I want to load a flat file into oracle Database. This flat file may be generated from table A or table B or table C.
So when I am loading this file into oracle table , I am exactly not sure how many columns and what data type is column has that flat file has ( depends on whether it is generated from table A or table B or table C ).
So, pls let me know the generic method, technique to load variable column length file into oracle database.
Example:
Table A
1 | 2 | 3 | 4
Table B
1 | XYZ | 3 | 4 | 5 | XXX
Table 3
xxx | 2013-09-28 | 10.0
So, here each table has variable columns and different datatype. How can I load these file into oracle database.
Thanks in advance.
One option is to use SQLLoader to load files into tables.
Say we have created three tables:
I am assuming that the file has always records in one format only (one of 3 possible formats).
In such a case, you can create 3 different control files for each format:
format_a.ctl
format_b.ctl
format_c.ctl
Then create a simple script that detects a format of the file and uploads data using an appropriate control file - this is an example for Windows environment:
In this line:
test/test@ is a database user
test
having passwordtest