In the process of migrating containers, if we have two tables;
TABLE_MAPPING (old_value, new_value)TABLE_USING (value, data...)
TABLE_USING is referencing (FK) a container in a irrelevant table.
TABLE_MAPPING is temporarily used for a migration, the goal is to move contents from deprecated to new containers.
The problem here is that sometimes the container is not only replaced, but split into multiple new containers, for example TABLE_MAPPING could contain:
| OLD_VALUE | NEW VALUE |
|---|---|
| 1 | 10 |
| 1 | 11 |
| 2 | 20 |
And the query would result in an "update" of one row with value '1' to two rows with values '10' and '11'.
Is there a plain SQL way to do that? Or should I use PL/SQL?
EDIT: as requested, here is an example of before/after using the TABLE_MAPPING above
Before:
| VALUE | IRRELEVANT_COLUMNS ... |
|---|---|
| 1 | ... |
| 2 | ... |
After:
| VALUE | IRRELEVANT_COLUMNS ... |
|---|---|
| 10 | ... |
| 12 | ... |
| 20 | ... |