From: | Marco Colombo <marco(at)esi(dot)it> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | newbie pl/pgsql question |
Date: | 2003-09-26 14:39:33 |
Message-ID: | Pine.LNX.4.44.0309261427000.25502-100000@Megathlon.ESI |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Is there a way to INSERT / UPDATE a row using the data stored in
a single %ROWTYPE variable?
Something along the line:
DECLARE
onerow table1%ROWTYPE;
BEGIN
-- get the data
SELECT INTO onerow <some expression>;
-- insert them into the table
INSERT INTO table1 VALUES onerow; -- this is not valid of course
END;
I know that:
INSERT INTO table1 VALUES (
onerow.col1,
onerow.col2,
...
onerow.col100);
will work, but i wonder if there's a smarter way.
Same for UPDATE (that one I understand is trickier).
TIA,
.TM.
--
____/ ____/ /
/ / / Marco Colombo
___/ ___ / / Technical Manager
/ / / ESI s.r.l.
_____/ _____/ _/ Colombo(at)ESI(dot)it
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-09-26 15:01:34 | initdb failure (was Re: [GENERAL] sequence's plpgsql) |
Previous Message | Didier Bretin | 2003-09-26 14:24:28 | Escape sequence for unicode characters |