Re: Need a script that bakes INSERT script from SELECT results

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Need a script that bakes INSERT script from SELECT results
Дата
Msg-id 5CDAA3CE-6B0F-4177-A5E1-241584EB6A90@pgedit.com
обсуждение исходный текст
Ответ на Need a script that bakes INSERT script from SELECT results  (ShuA <noface@inbox.ru>)
Ответы Re[2]: Need a script that bakes INSERT script from SELECT results  (ShuA <noface@inbox.ru>)
Список pgsql-sql
On Apr 16, 2009, at 7:29 AM, ShuA wrote:

> Could someone post an example how to LOOP through row fields to wrap  
> them into 'VALUES(...,,)' list?


If you declare record or table row types, you can insert the values  
using (rec.*), something like this:


create or replace function test ()
returns void as $$
declarerec record;
beginfor rec in select * from whatever loop    insert into some_table values (rec.*);end loop;
end;
$$ language plpgsql;






John DeSoi, Ph.D.






В списке pgsql-sql по дате отправления:

Предыдущее
От: ShuA
Дата:
Сообщение: Need a script that bakes INSERT script from SELECT results
Следующее
От: ShuA
Дата:
Сообщение: Re[2]: Need a script that bakes INSERT script from SELECT results