X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 01344DA6C8 for ; Mon, 17 Oct 2005 00:24:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59836-04 for ; Mon, 17 Oct 2005 03:24:45 +0000 (GMT) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.197]) by svr1.postgresql.org (Postfix) with ESMTP id 65782DA687 for ; Mon, 17 Oct 2005 00:24:45 -0300 (ADT) Received: by qproxy.gmail.com with SMTP id p32so186078qba for ; Sun, 16 Oct 2005 20:24:44 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=jSrJAqQM7O2sYDHPopxLwTs7E5cQFVkCYqAWolCyofpEc6EsXI6WFEsvjvMxlNYYNde4YuAlKtbTgQO38pfIhPR2gDi9KAqdZ2EyvlyuCsnW/VeYXyXRN8vZLJFAFYMEuGWw9b2EELxmAw0jqoLQnQBI7RQAWUbq2OpKKp6kQSY= Received: by 10.65.160.11 with SMTP id m11mr1601469qbo; Sun, 16 Oct 2005 20:24:44 -0700 (PDT) Received: by 10.65.113.10 with HTTP; Sun, 16 Oct 2005 20:24:44 -0700 (PDT) Message-ID: <2f8663320510162024j17b4fdb0n4d2b5df1e32d1863@mail.gmail.com> Date: Sun, 16 Oct 2005 23:24:44 -0400 From: Mike Plemmons To: PostgreSQL List Subject: Question about functions MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_17172_20941821.1129519484117" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.32 required=5 tests=[HTML_10_20=0.295, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200510/176 X-Sequence-Number: 23029 ------=_Part_17172_20941821.1129519484117 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 th= e 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 A= S $$ 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 ------=_Part_17172_20941821.1129519484117 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 A= S $$
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
------=_Part_17172_20941821.1129519484117--