sql - query return setof - update data -
i have postgres function, returns setof. can create table directly using insert into
, not want.
select id, my_func() insert data2
i need update data in existing table based on setof result rows. how can this? need select id, my_func() t update data2 set data = t data2.id = id
you didn't show function returns, should work:
update data2 set data = f.data_column my_func() f (id, data_column) t.id = data2.id;
this assumes function returns 2 columns can join target table against function result.
Comments
Post a Comment