OiO.lk Blog SQL MERGE RETURNING into temp
SQL

MERGE RETURNING into temp


Is something like this possible without having to use WITH?
Can CREATE TEMP TABLE temp AS be used instead of creating the temp table manully?

CREATE TEMP TABLE temp
(
    action    text,
    winery_id int,
    brand     text
);

MERGE INTO wines w
USING wines_updates u
ON u.winery_id = w.winery_id
WHEN MATCHED THEN
    UPDATE
    SET stock = u.stock
RETURNING merge_action() action, w.winery_id, w.brand INTO temp;



You need to sign in to view this answers

Exit mobile version