Re: [SQL] Function result using execute

2007-12-11 Thread Paul Lambert
Tom Lane wrote: Do you really need an EXECUTE? If so, maybe you could restructure this using a FOR ... IN EXECUTE, or some such thing. I'll always only ever have a single result since the function gets passes all the fields making up the primary key of the table, so doing a for in seems like

Re: [SQL] Function result using execute

2007-12-11 Thread Erik Jones
On Dec 11, 2007, at 11:15 PM, Paul Lambert wrote: I have a function which uses execute to populate the value of a variable based on a defined select construct. The relevant part of the code looks like thus: EXECUTE curr_query INTO curr_amount; RAISE NOTICE '%',curr_amount; IF NOT FO

Re: [SQL] Function result using execute

2007-12-11 Thread Tom Lane
Paul Lambert <[EMAIL PROTECTED]> 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 populat

[SQL] Function result using execute

2007-12-11 Thread Paul Lambert
I have a function which uses execute to populate the value of a variable based on a defined select construct. 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; RAISE NOTI