Insert values from a record variable into a table
3
votes
4
answers
31876
views
I am developing a user-defined function that takes two arguments:
create or replace function gesio(
events_table_in regclass,
events_table_out regclass)
returns void as $$ ... $$
events_table_in
and events_table_out
have exactly the same schema.
Simply explained, I loop through the records of events_table_in
, manipulate the records and want to append (insert) the manipulated records into events_table_out
in the following fashion:
OPEN recCurs FOR execute
format('SELECT * FROM %s order by session_id, event_time', event_table_in);
LOOP
FETCH recCurs into rec;
if not found then
exit;
end if;
-- 1. do something with rec
-- 2. insert the rec into events_table_out
end loop;
How can I save the rec
into events_table_out
?
Asked by arthur
(888 rep)
Nov 5, 2013, 04:04 PM
Last activity: Jul 19, 2023, 10:40 AM
Last activity: Jul 19, 2023, 10:40 AM