2

I have 20 tables that are temp-tables where we load and validate data constantly and I have a control file for each table.

How can I have a unique control file that just changes the table the data is loaded into? Any suggestion?

Thanks in advance!

---Oracle info---

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi

4
  • 1
    are the 20 temp tables the same layout except for name? Commented Jan 5, 2012 at 15:44
  • yes they have the same layout Commented Jan 5, 2012 at 16:11
  • @tbone does it matter? I would love it if so! @BRabbit27; dynamic ctl files implies another language to scan the table and the file and create it for you, i.e. python (I'm biased) etc. Commented Jan 7, 2012 at 11:08
  • @Ben the o/s matters if your solution is outside sqlldr itself (one thought was to use sed/awk in linux script to dynamically create the ctl files), or windows use perl (or python if u really must ;) Still, a bit of a hack I agree Commented Jan 9, 2012 at 11:57

2 Answers 2

2

Suggest you write your control file load the data into a synonym rather than into the specific table. Begin each load run by redefining the synonym to the table you want.

Sign up to request clarification or add additional context in comments.

3 Comments

A synonym is an alternative name referring to a table (or other Oracle DB object). You create it as follows: create synonym LOAD_HERE for TEMPTAB_07; See the CREATE SYNONYM page for additional details.
Ok got it. So in my app before loading data I redefine that Synonym to point to the table I want to load data and voilà ... yes I think this is a very nice solution ... I'll check this out right now... BTW is there an API to call SqlLoader from Java? Now I'm executing SqlLoader from Java using the exec() method (executing a command on console) thanks
@AndrewWolfe this'll only work if the data structures are identical or at least all tables have the same columns just some have more. Also any transformations on the data would have to be identical.
0

Maybe you can use multiple INTO TABLE clauses, and distinguish bitween them, somehow, with the WHEN clause.
Look here for more details

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.