13 lines
425 B
MySQL
13 lines
425 B
MySQL
|
MERGE INTO
|
||
|
rlarp.customer_review w
|
||
|
USING
|
||
|
( SELECT $1 bill_cust, $2 ship_cust, $3::numeric expected, $4 expecteduom) as i ON
|
||
|
i.ship_cust = w.ship_cust
|
||
|
AND i.bill_cust = w.bill_cust
|
||
|
WHEN MATCHED THEN UPDATE SET
|
||
|
newords = i.expected
|
||
|
,newuom = i.expecteduom
|
||
|
WHEN NOT MATCHED THEN
|
||
|
INSERT (bill_cust, ship_cust, newords, newuom)
|
||
|
VALUES (bill_cust,i.ship_cust, i.expected, i.expecteduom)
|