Question about functions

From: Mike Plemmons <mikeplemmons(at)gmail(dot)com>
To: PostgreSQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Question about functions
Date: 2005-10-17 03:24:44
Message-ID: 2f8663320510162024j17b4fdb0n4d2b5df1e32d1863@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have been looking through FAQs and the docs and I cannot seem to find the
answer to this question. If someone can point me to documentation I would
really appreciate it.

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
$$
DECLARE
myrec record;
BEGIN
FOR myrec IN SELECT * FROM tblStuff WHERE ides LIKE '%$1%' LOOP
RETURN NEXT myrec;
END LOOP;
RETURN;
END;
$$ LANGUAGE 'plpgsql';

Thanks so much for any insight you can give me!!!
Mike

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stewart Ben (RBAU/EQS4) * 2005-10-17 04:41:21 Re: Question about functions
Previous Message paperinik 100 2005-10-15 08:49:15 problems with array