October 22, 2024
Chicago 12, Melborne City, USA
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

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video