Problem with FOR SELECT in plpgsql function
От | Plant Thomas |
---|---|
Тема | Problem with FOR SELECT in plpgsql function |
Дата | |
Msg-id | 418DEFFAA399D311818A00508B912F2801A9F748@idefix.lvh.dnet.it обсуждение исходный текст |
Ответы |
Re: Problem with FOR SELECT in plpgsql function
|
Список | 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
В списке pgsql-sql по дате отправления: