15 lines
528 B
SQL
15 lines
528 B
SQL
MERGE INTO
|
|
rlarp.walk_r1 w
|
|
USING
|
|
( SELECT $1 bill_cust, $2 ship_cust, $3 bucket, $4 attainment, $5 notes, $6 fcnotes) as i ON
|
|
i.ship_cust = w.ship_cust
|
|
AND i.bill_cust = w.bill_cust
|
|
WHEN MATCHED THEN UPDATE SET
|
|
bucket = i.bucket
|
|
,attainment = i.attainment::numeric
|
|
,notes = i.notes
|
|
,fcnotes = i.fcnotes
|
|
WHEN NOT MATCHED THEN
|
|
INSERT (bill_cust, ship_cust, bucket, attainment, notes, fcnotes)
|
|
VALUES (bill_cust,i.ship_cust, i.bucket, i.attainment::numeric, i.notes , i.fcnotes)
|