Mike,

> I am trying to run this function but the return is not 
> correct.  If I run the select statement from the psql command 
> line it works.  My guess is that the WHERE clause could be 
> causing the problem.  Then again, it may be how I am using 
> the FOR loop.  The ides column is of type TEXT.
> 
> CREATE OR REPLACE FUNCTION sp_description_search(varchar) 
> RETURNS varchar AS $$         -- <== Problem is here
> DECLARE
> myrec record;
> BEGIN
> FOR myrec IN SELECT * FROM tblStuff WHERE ides LIKE '%$1%' LOOP
> RETURN NEXT myrec;            -- <== Problem is here
> END LOOP;
> RETURN;
> END;
> $$ LANGUAGE 'plpgsql';

You need to declare this as a set-returning function if you're using
RETURN NEXT.

Best regards,

Ben Stewart

--
Robert Bosch (Australia) Pty. Ltd.
Engineering Quality Services, Student Software Engineer (RBAU/EQS4)
Locked Bag 66 - Clayton South, VIC 3169 - AUSTRALIA
mailto:[EMAIL PROTECTED]
http://www.bosch.com.au/ 

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to