Reputation: 10422
At first, I want to update a table, then want to select updated rows. How can I do this in a single query. let say, I have updated a table following way
UPDATE suppliers
SET city = (SELECT customers.city
FROM customers
WHERE customers.customer_name = suppliers.supplier_name)
WHERE EXISTS (SELECT customers.city
FROM customers
WHERE customers.customer_name = suppliers.supplier_name)
Now, How can I select this updated rows
Upvotes: 0
Views: 4858
Reputation: 7693
try this for oracle using Returning:
UPDATE <table> SET (c1) = (v1) WHERE <condition> RETURNING <expression> INTO <variables>
Upvotes: 1