2023-09-01 08:29:11 -04:00
|
|
|
MERGE INTO
|
2023-10-18 15:00:33 -04:00
|
|
|
rlarp.walk_r1 w
|
2023-09-01 08:29:11 -04:00
|
|
|
USING
|
2023-10-18 15:00:33 -04:00
|
|
|
( SELECT $1 bill_cust, $2 ship_cust, $3 bucket, $4 attainment, $5 notes) as i ON
|
2023-09-01 08:29:11 -04:00
|
|
|
i.ship_cust = w.ship_cust
|
2023-10-18 15:00:33 -04:00
|
|
|
AND i.bill_cust = w.bill_cust
|
2023-09-01 08:29:11 -04:00
|
|
|
WHEN MATCHED THEN UPDATE SET
|
|
|
|
bucket = i.bucket
|
2023-10-18 15:00:33 -04:00
|
|
|
,attainment = i.attainment::numeric
|
2023-09-01 08:29:11 -04:00
|
|
|
,notes = i.notes
|
|
|
|
WHEN NOT MATCHED THEN
|
2023-10-18 15:00:33 -04:00
|
|
|
INSERT (bill_cust, ship_cust, bucket, attainment, notes)
|
|
|
|
VALUES (bill_cust,i.ship_cust, i.bucket, i.attainment::numeric, i.notes )
|