Home » RDBMS Server » Server Utilities » Insert into multiple tables
Insert into multiple tables [message #73219] Thu, 04 March 2004 04:15 Go to next message
sri
Messages: 154
Registered: February 2000
Senior Member
Hi,

I have gone through the the topic "Can one load data into multiple tables at once?" But I am facing problem in inserting the data. My problem is that I have to insert the data from a text file in two tables simultaneously one in insert mode and another in append mode. I used the same syntax but I am only getting data in one table(first one). The code which I wrote is:

LOAD DATA
INFILE 'abc.txt'
REPLACE
INTO TABLE MainTable
when (ID!='RAGER')
fields terminated by "&#124"
optionally enclosed by '"'
trailing nullcols
( ID    "'GER'||UPPER(:ID)", 
  NAME  CHAR,
  status    "decode(:status,null,'NEW','NEW')",
  PROCESS_STATUS "decode(:PROCESS_STATUS,null,NULL)"
)
INTO TABLE BulkTable
when (ID!='RAGER')
fields terminated by "&#124"
optionally enclosed by '"'
trailing nullcols
( ID    "'GER'||UPPER(:ID)", 
  NAME  CHAR,
  status    "decode(:status,null,'NEW','NEW')",
  PROCESS_STATUS "decode(:PROCESS_STATUS,null,NULL)"
)

How can I insert same data into two tables. One in insert mode and another in append mode. I tried Insert and Append keywords also but to no success. Please help me with this.

Thanks,
Sri
Re: Insert into multiple tables [message #73239 is a reply to message #73219] Sat, 06 March 2004 13:04 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9097
Registered: November 2002
Location: California, USA
Senior Member
You could create two separate control files and do two separate runs of SQL*Loader. Or, if you can re-create your abc.txt as fixed position, that may solve the problem. SQL*Loader seems to balk at the combination of delimited file, multiple into table clauses and when clauses, but works O.K. with fixed position.
Re: Insert into multiple tables [message #73258 is a reply to message #73239] Wed, 10 March 2004 00:07 Go to previous message
sri
Messages: 154
Registered: February 2000
Senior Member
thanks for the help... I too think in the same line.
Previous Topic: How to use a variable in a control file
Next Topic: Time efforts for Export/Import
Goto Forum:
  


Current Time: Sat Jun 29 05:33:33 CDT 2024