Re: regarding select into

From: "Rolf stvik" <rolfostvikjobb(at)yahoo(dot)no>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: regarding select into
Date: 2005-09-27 07:04:38
Message-ID: Xns96DE5C585512Crolfostvikjobbyahoon@200.46.204.72
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in ("surabhi.ahuja") wrote in
news:967CFC4343BF2A4DAFACD026D33DC85118EC70(at)jal(dot)iiitb(dot)ac(dot)in:

> Hello,
>
> Is it not possible to write such an sql statement:
>
> select ser into val1, count(*) into val2 from tab1 where id = $1;
>
> do i need to perform the 2 selects separately ..wont that impact the
performance?
>
> in the table tab1, id is the primary key.
>

Pleas don't attach html to your e-mails.
(Normally you should be able to turn that functionality off).

Your question might be unclear.
I might be wrong but is it a PG/pgSQL funtion you are writing?

In that case i think you can use:

select into val1,val2 ser,count(*) from tab1 where id = $1;

(found in chapter "37.6.2 Select into" in my 7.4.2 documentation:

--
Rolf

In response to

Browse pgsql-general by date

  From Date Subject
Next Message adccs 2005-09-27 07:37:11 Restore xxxxx.backup database
Previous Message Qingqing Zhou 2005-09-27 06:31:16 Re: Can not get ODBC to log. Trace is not working.