I am having an XML which has data for multiple tables. Now i want to insert/update into database. If the primary key already exists in the database, then it have to update the record from XML, else insert new record. Note: I have millions of records. So please suggest me the best way to do this.
My xml will looks like:
<Table1>
<Key>1</Key>
<Value>Data</value>
</Table1>
<Table2>
<Key>1</Key>
<Value>Data</Value>
</Table2>
<Table2>
<Key>2</Key>
<Value>Updated data</Value>
<Table2>
Existing Database:
Table1 Table2
--------------------- -------------------------
Key Value Key Value
1 Data 1 Data
2 Data
Expected Result: After importing the XML
Table1 Table2
--------------------- -------------------------
Key Value Key Value
1 Data 1 Data
2 Updated data
Note: At Table2, the Value for the Key "2" become "Updated data", and remaining records are same. I have millions of records like this.
How can i achieve this in Oracle database using .NET. Please help. Thanks in advance.
Regards,
Kannan