背景
我希望按计划在一个过程中运行此合并。我必须在sql数据库表中插入新数据,如果数据存在,我想更新数量。
问题:
我正在尝试从Oracle数据库合并到SQL数据库并收到错误(请参阅此问题的标题)。我已经尝试使用与用于创建视图的相同sql脚本的合并,并返回相同的错误。
问题:
问题出在我的代码中(见下文)?
MERGE INTO "receipt_details"@invware d
USING (
SELECT *
FROM raf_po_receiving_details_v
WHERE last_update_date >= '1-AUG-2013' ) s
ON ( "po_header_id" = s.po_header_id
and "po_line_id" = s.po_line_id )
WHEN MATCHED THEN UPDATE
SET "purchased_qty" = s.purchased_qty,
"qty_received" = s.qty_received,
"balance_remaining" = s.balance_remaining,
"qty_billed" = s.qty_billed
WHEN NOT MATCHED THEN INSERT ( "warehouse_code", "po_number", "po_header_id",
"vendor_name", "line_num",
"item_code", "purchased_qty", "qty_received",
"rcv_by", "balance_remaining", "qty_billed",
"closed_code", "rec_date", "need_by_date", "po_line_id" )
VALUES (s.warehouse_code, s.po_number, s.po_header_id, s.vendor_name,
s.line_num, s.item_code, s.purchased_qty, s.qty_received, s.rcv_by,
s.balance_remaining, s.qty_billed, s.closed_code, s.rec_date, s.need_by_date, po_line_id);