1
我正在使用以下查詢(對於一列即base_price正常工作),但是當我嘗試更新多個列時,我正在獲取ORA-01767:UPDATE .. 。SET表達式必須是子查詢。無法使用'with'子句更新多個列
UPDATE quote_item qi
SET (qi.base_price,qi.base_cost)
=
(WITH baseVersion AS
(SELECT qi1.quote_oid, qi1.item_num, qi1.sub_item_num as sub_item_num, q1.quote_num, qi1.base_price, qi1.base_cost
FROM quote q1,
quote_item qi1
WHERE q1.oid = qi1.quote_oid
AND q1.quote_type_oid=4
AND q1.version_num = 0
)
SELECT bv.base_price,bv.base_cost
FROM baseVersion bv,
quote revQuote
WHERE revQuote.oid = qi.quote_oid
AND revQuote.quote_num = bv.quote_num
AND qi.item_num =bv.item_num
AND qi.sub_item_num =bv.sub_item_num
AND revQuote.version_num >0 and revQuote.quote_type_oid=4
)
where qi.quote_type_oid=4;
後一些環顧四周,我發現,它可以從與子句再次選擇做一個解決方案,但我不能夠實現它在我的查詢reference。
任何人都知道如何做到這一點?