From: Plant Thomas <Thomas.Plant@lvh.it>
To: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Problem with FOR SELECT in plpgsql function
Date: Fri, 20 Feb 2004 11:07:22 +0100
Message-ID: <418DEFFAA399D311818A00508B912F2801A9F748@idefix.lvh.dnet.it> (raw)
I have a problem with the following function:
CREATE OR REPLACE FUNCTION "weiterbildung"."f_termine_uhrzeit" (integer)
RETURNS text AS'
DECLARE
id ALIAS for $1;
dat RECORD;
uhrzeiten text;
BEGIN
uhrzeiten = '''';
FOR dat IN SELECT vormittag_a, vormittag_e, nachmittag_a, nachmittag_e
FROM weiterbildung.t_termine where id_kurs = id order by datum
LOOP
uhrzeiten :=
uhrzeiten||to_char(dat.vormittag_a,''HH24:MI'')||''(''||to_char(dat.vormitta
g_a,''HH24:MI'')||''-''||to_char(dat.vormittag_e,''HH24:MI'')||''
''||to_char(dat.nachmittag_a,''HH24:MI'')||''-''||to_char(dat.nachmittag_e,'
'HH24:MI'')||'')'';
END LOOP;
RETURN uhrzeiten;
END;
'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
This function sometimes returns null even if there is a record in the
database for the corrisponding id.
This happens only when there is only one record for the corrisponding id
value in the database, if there
are more than one record it works with no problem.
Is there a bug in the FOR SELECT statement?
Thanks for advice
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Thomas.Plant@lvh.it
Subject: Re: Problem with FOR SELECT in plpgsql function
In-Reply-To: <418DEFFAA399D311818A00508B912F2801A9F748@idefix.lvh.dnet.it>
References: <418DEFFAA399D311818A00508B912F2801A9F748@idefix.lvh.dnet.it>
* 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