Re: select into multiple variables

Поиск
Список
Период
Сортировка
От SunWuKung
Тема Re: select into multiple variables
Дата
Msg-id MPG.1e308a00aef3b52d989688@news.postgresql.org
обсуждение исходный текст
Ответ на select into multiple variables  (SunWuKung <Balazs.Klein@axelero.hu>)
Список pgsql-general
In article <MPG.1e3088f9e44ccb3989687@news.postgresql.org>,
Balazs.Klein@axelero.hu says...
> I have a select statement in a pgpsql function that returns two columns
> and a single row.
> I would like to place the two values into two variables in a single
> statement, but so far I couldn't find out what is the syntax for that.
>
> I tried a couple of combinations of this but had no luck:
>
> SELECT INTO
>  instrumentheaderid_arg, subjectgroupheaderid_arg,
>  instrumentnormheader.instrumentheaderid,
>  instrumentnormheader.subjectgroupheaderid
> FROM
>  instrumentnormheader
> WHERE instrumentnormheaderid=3
>
> Thanks for the help.
> B.
>

ugh, sorry, found it

SELECT INTO
instrumentheaderid_arg, subjectgroupheaderid_arg
instrumentnormheader.instrumentheaderid,
instrumentnormheader.subjectgroupheaderid
FROM
  public.instrumentnormdetail
  INNER JOIN public.instrumentnormheader ON
(public.instrumentnormdetail.instrumentnormheaderid =
public.instrumentnormheader.instrumentnormheaderid)
WHERE instrumentnormdetailid=instrumentnormdetailid_arg;

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

Предыдущее
От: SunWuKung
Дата:
Сообщение: select into multiple variables
Следующее
От: Tino Wildenhain
Дата:
Сообщение: Re: sql (Stored procedure) design question