Re: select into multiple variables

From: SunWuKung <Balazs(dot)Klein(at)axelero(dot)hu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: select into multiple variables
Date: 2006-01-12 14:45:41
Message-ID: MPG.1e308a00aef3b52d989688@news.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <MPG(dot)1e3088f9e44ccb3989687(at)news(dot)postgresql(dot)org>,
Balazs(dot)Klein(at)axelero(dot)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;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mikael Carneholm 2006-01-12 14:52:49 Plans for 8.2?
Previous Message SunWuKung 2006-01-12 14:44:28 select into multiple variables