I am trying to update three tables in Oracle, which are totally different, but in all of them there is an exactly the same field "STATUS".
The issue is that I need these fields to be updated to "NEW".
This is why I have wondered if it is possible to update multiple tables at the same time.
I thought of something like this, however it throws me an error:
UPDATE SS_WERUECK, SS_BESTELLUNGR, SS_KOMMBESTR
SET STATUS = 'NEW';
I stay tuned in advance thank you.
There is no statement
UPDATE
that allows you to update all 3 tables at once. But really, that shouldn't matter.If what you want is for all changes to be applied atomically, it's just a matter of all changes being made within the same transaction:
And if you really want all 3 updates to be done in one statement for whatever reason, you can always do it using an anonymous PL/SQL block:
Try a procedure:
This is also applicable in case you want to delete data in tables. In case these are indexed, they will have to be eliminated in cascade considering the order of the first table as the data that must be eliminated first, until the last one that can be eliminated once there is no place that indexes with that table. In this case, remember to change "update" to "delete".