Re: selecting into a variable like @var=select ...

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: selecting into a variable like @var=select ...
Дата
Msg-id 200312161812.40402.dev@archonet.com
обсуждение исходный текст
Ответ на selecting into a variable like @var=select ...  (joseph speigle <joe.speigle@jklh.us>)
Ответы Re: selecting into a variable like @var=select ...
Re: selecting into a variable like @var=select ...
Список pgsql-general
On Tuesday 16 December 2003 17:12, joseph speigle wrote:
> hello list,
>
> I want to do something like the following:
>
> address=# @var = select max(id) from passwd;
> ERROR:  parser: parse error at or near "@" at character 1

> so that I could then issue
>
> create sequence passwd_id_seq start @var increment 1
>
> how can I declare and capture output into this variable? Or, should I
> create a function, if it is possible to issue a "create" statement inside a
> procedure body?

You'll have to use a function (plpgsql would be the obvious choice). You can
issue almost all statements by building them up in a string and using
EXECUTE.

--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: Rory Campbell-Lange
Дата:
Сообщение: Reload bytea [was Re: Picture with Postgres and Delphi]
Следующее
От: Joe Conway
Дата:
Сообщение: Re: DB with bytea types reload problem