From: Alexander M. Pravking <fduch@antar.bryansk.ru>
To: pgsql-sql@postgresql.org
Subject: Row count after SELECT INTO?
Date: Wed, 7 Apr 2004 23:04:26 +0400
Message-ID: <20040407190426.GI41029@dyatel.antar.bryansk.ru> (raw)
Dear SQL and plPgSQL gurus, I seek for your wisdom.
I have a variable assignment via SELECT INTO in my function, and I want
to separate 3 cases:
1) no rows found;
2) one row found;
3) many rows found (ambiguous select).
The first case is simple, I use FOUND variable for it.
But how about the third? I tried to GET DIAGNOSTICS nrows = ROW_COUNT,
bit it seems to get only value of 0 or 1. Is this how it supposed to be
when SELECTing INTO a single variable?
The only way I see now is a FOR ... IN SELECT loop, and I woner if
there is a simpler solution. Could you please help me?
--
Fduch M. Pravking
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: fduch@antar.bryansk.ru
Subject: Re: Row count after SELECT INTO?
In-Reply-To: <20040407190426.GI41029@dyatel.antar.bryansk.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox