Re: SQL stored function inserting and returning data in a row.

Поиск
Список
Период
Сортировка
От Marcin Stępnicki
Тема Re: SQL stored function inserting and returning data in a row.
Дата
Msg-id 179149fe0801110315w24bd1da8lcdd13c8875265f40@mail.gmail.com
обсуждение исходный текст
Ответ на SQL stored function inserting and returning data in a row.  ("Daniel Caune" <daniel.caune@ubisoft.com>)
Список pgsql-sql
On Jan 11, 2008 4:23 AM, Daniel Caune <daniel.caune@ubisoft.com> wrote:
> Hi,
>
> Is there any way to define a SQL stored function that inserts a row in a
> table and returns the serial generated?

Maybe you just need INSERT ... RETURNING?

http://www.postgresql.org/docs/8.2/interactive/sql-insert.html

" Insert a single row into table distributors, returning the sequence
number generated by the DEFAULT clause:

INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')  RETURNING did;
"


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

Предыдущее
От: Gerardo Herzig
Дата:
Сообщение: Re: SQL stored function inserting and returning data in a row.
Следующее
От: "Marcin Stępnicki"
Дата:
Сообщение: Re: SQL stored function inserting and returning data in a row.