Update and insert in one query
Hi,
I want to update one table and insert to another table in one query, but the insert command cannot see the statement.id from the update. Appreciate clues
update Device, (select id, alertState, lastContact from Device where lastContact < 1511765116 and alertState = 0) as statement set Device.alertState = 1 where Device.id = statement.id; insert Alert (DeviceId, Message) value (statement.id, "Alert");
Thank you.
Kind regards,
Subject
Views
Written By
Posted
Update and insert in one query
892
November 27, 2017 12:28AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.