patternMinor
Can Oracle SQL developer export data as a set of Update commands?
Viewed 0 times
canupdatesqlcommandsexportdeveloperoracledataset
Problem
Oracle SQL developer gives us the option of exporting data. But it only gives us the option to export as a set of Insert statements.
I have two databases with a mirrored table. One of them has some column data missing from it. I tried truncating the data from that table but it has foreign keys associated and SQL doesn't let me drop it.
Is there a way to export the data from the larger/fuller table in the form of "Update Table..." commands? I tried googling first, failed. I bet there's a solution for this out there.
If nothing else, I am thinking of making a small python script that modifies the Insert command set into an Update command set after export.
I have two databases with a mirrored table. One of them has some column data missing from it. I tried truncating the data from that table but it has foreign keys associated and SQL doesn't let me drop it.
Is there a way to export the data from the larger/fuller table in the form of "Update Table..." commands? I tried googling first, failed. I bet there's a solution for this out there.
If nothing else, I am thinking of making a small python script that modifies the Insert command set into an Update command set after export.
Solution
What you want is MERGE.
See Oracle docs for MERGE . Allows you determine if a row should be updated or inserted.
SQL Developer doesn't support generating MERGE statements today. You can go vote for that feature to make a future version though!
See Oracle docs for MERGE . Allows you determine if a row should be updated or inserted.
SQL Developer doesn't support generating MERGE statements today. You can go vote for that feature to make a future version though!
Context
StackExchange Database Administrators Q#15012, answer score: 2
Revisions (0)
No revisions yet.