Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Adding changed records
Originally posted by Randy Harris
> The Oracle 8i database will contain tables with customer
> information. I am
> to be given a comma delimited flat file, on a nightly basis,
> containing
> changes to the data. The changes will include both updated
> records and new
> records, with no hint as to which is which. I need to
> "synchronize" the
> changes into the database. I don't think a stored procedure is
> going to be
> an option, that's why I asked for advice on doing it with either
> sqlplus or
> sqlloader.
>
> It seems to me that it would be clumsy with sqlplus. I would have
> to read in
> each of the lines from the cdf, then query to see if there was a
> matching
> record, then do either an UPDATE or and INSERT. I don't know
> much about
> sqlloader, but have been reading the documentation. I see that
> it can do
> either UPDATE or APPEND and discards records to a file. I
> thought perhaps
> there might be a mechanism in there somewhere. I was hoping
> that someone
> who has had experience in this area might get me started in the right
> direction.
Have a look at the Oracle MERGE command:
http://technet.oracle.com/docs/products/oracle9i/doc_library/release2/server. 920/a96540/statements_915a.htm#SQLRF01606
Maybe that in combination with an external table:
http://technet.oracle.com/docs/products/oracle9i/doc_library/release2/server. 920/a96652/part3.htm#436392
.. will give you all you need.
I haven't done this though, just aware of these features.
-- Posted via http://dbforums.comReceived on Tue May 06 2003 - 09:53:38 CDT