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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -