From: | Plant Thomas <Thomas(dot)Plant(at)lvh(dot)it> |
---|---|
To: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Problem with FOR SELECT in plpgsql function |
Date: | 2004-02-20 10:07:22 |
Message-ID: | 418DEFFAA399D311818A00508B912F2801A9F748@idefix.lvh.dnet.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2004-02-20 11:09:32 | Re: Problem with FOR SELECT in plpgsql function |
Previous Message | Fabian | 2004-02-20 09:56:05 | transaction block causing trouble |