Re: How do I insert a record into a table?

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: How do I insert a record into a table?
Дата
Msg-id 16040AEB-8892-40FA-937C-79CD7FE73354@seespotcode.net
обсуждение исходный текст
Ответ на How do I insert a record into a table?  (Brian Hurt <bhurt@janestcapital.com>)
Ответы Re: How do I insert a record into a table?  (Brian Hurt <bhurt@janestcapital.com>)
Список pgsql-novice
On Jun 1, 2007, at 13:31 , Brian Hurt wrote:

>
> I want to write a query like:
>
> INSERT INTO table SELECT func(args);

I think you might want to try something along the lines of
INSERT INTO table (col1, col2, col3)
SELECT col1, col2, col3
FROM func(args);

Then again, you could wrap the whole insert into the function:

CREATE FUNCTION func(args)
RETURNS VOID
LANGUAGE plpgsql AS $_$
-- ...
INSERT INTO table (col1, col2, col3)...
$_$;

then SELECT func(args); to call the function.

Michael Glaesemann
grzm seespotcode net



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

Предыдущее
От: Brian Hurt
Дата:
Сообщение: How do I insert a record into a table?
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: How do I insert a record into a table?