Re: Function result using execute
От | Tom Lane |
---|---|
Тема | Re: Function result using execute |
Дата | |
Msg-id | 12742.1197439311@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Function result using execute (Paul Lambert <paul.lambert@reynolds.com.au>) |
Ответы |
Re: Function result using execute
|
Список | pgsql-sql |
Paul Lambert <paul.lambert@reynolds.com.au> writes: > The relevant part of the code looks like thus: > EXECUTE curr_query INTO curr_amount; > RAISE NOTICE '%',curr_amount; > IF NOT FOUND THEN > curr_amount=0; > END IF; > ... which suggests to me that although the > execute has populated the curr_amount field with something, the IF NOT > FOUND is always firing. IIRC, the EXECUTE command does not change FOUND --- leastwise it's not listed as one of the plpgsql commands that do set FOUND. Do you really need an EXECUTE? If so, maybe you could restructure this using a FOR ... IN EXECUTE, or some such thing. > therefore I just be using a test of IF curr_amount IS NOT NULL? Well, that might work. Have you thought through the corner case where the query does find a row but the field's value is null? regards, tom lane
В списке pgsql-sql по дате отправления: