1st question: I am trying to load test1.csv, test2.csv and test3.csv to table1, table2 and table3 respectively using SQLLDR. Please bear with my lack if knowledge in this area, I couldn't get it quite right while defining this in .ctl file, only I can think of is the below code but this is not correct. so my question is how can I make this right or is this possible?
OPTIONS (SKIP=1)
LOAD DATA
INFILE 'test1.csv'
INFILE 'test2.csv'
INFILE 'test2.csv'
TRUNCATE
INTO TABLE table1
fields terminated by ',' optionally enclosed by '"'
TRAILING NULLCOLS
(
Col1 "TRIM(:Col1)",
Col2 "TRIM(:Col2)"
)
INTO TABLE table2
fields terminated by ',' optionally enclosed by '"'
TRAILING NULLCOLS
(
Colx "TRIM(:Colx)",
Coly "TRIM(:Coly)"
)
INTO TABLE table3
fields terminated by ',' optionally enclosed by '"'
TRAILING NULLCOLS
(
Colp "TRIM(:Colp)",
Colq "TRIM(:Colq)"
)
2nd question: This is an alternative to this first question. Since I couldn't figure it out the first one, what I have done is splitting the loads for each table into multiple .ctl files and calling those all three in a .bat file. This works at least but my question is there a way to process all these 3 .ctl files in a session without mentioning user/password 3 times as below?
sqlldr userid=user/pass@server control=test1.ctl
sqlldr userid=user/pass@server control=test2.ctl
sqlldr userid=user/pass@server control=test3.ctl