在oracle 11g中更新并选择单个查询

时间:2013-04-29 09:59:37

标签: sql oracle11g

首先,我想更新一个表,然后想要选择更新的行。如何在单个查询中执行此操作。 比方说,我已经按照方式更新了表格

    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)

现在,我如何选择此更新的行

1 个答案:

答案 0 :(得分:1)

使用返回来尝试使用oracle:

UPDATE <table> SET (c1) = (v1) WHERE <condition> RETURNING <expression> INTO <variables>