How do I load files with multiple master detail data?
I would like to load below files into the oracle database which have multiple master detail data using the sqlldr.
Sample File :
1 015
3 brnadcode1 brandname1
3 brnadcode2 brandname2
3 brnadcode3 brandname3
1 018
3 patterncode1 pattername1 address1
3 patterncode2 pattername2 address2
3 patterncode3 pattername3 address3
- 1st row have the record type "1" and table code "015"
- Rows below 1st row with record type "3" which have the brandcode and brandname that requires to load in brand_master table
- 5th row have the record type "1" and table code "018"
- Rows below 5th row with record type "3" which have the patterncode, pattername and address that requires to load in pattern table
As per my understanding to load this files in using sqlldr need to follow the below steps
- Generate the two separate files using the UTL_FILE Package
- a) brand.txt which have the records brandcode, brandname
- b) pa开发者_如何学Pythonttern.txt which have the records patterncode,pattername,address
- Write 2 separte control files for brand.txt and pattern.txt to load in database table
Can any one help to load above file with only one control file in multiple table?
I don't believe there is any way that SQL Loader can use the 015 and 018 codes. However, if the requirements are as stated then you could perhaps use multiple INTO clauses to load into the appropriate table by determining whether there is an address or not. Something like:
INTO TABLE brand_master
WHEN address = BLANKS
...
INTO TABLE pattern
WHEN address != BLANKS
...
精彩评论