| From: | Richard Huxton <dev(at)archonet(dot)com> |
|---|---|
| To: | Mike Plemmons <mikeplemmons(at)gmail(dot)com> |
| Cc: | PostgreSQL List <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Question about functions |
| Date: | 2005-10-17 08:17:49 |
| Message-ID: | 43535E2D.8080500@archonet.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Mike Plemmons wrote:
> 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.
> FOR myrec IN SELECT * FROM tblStuff WHERE ides LIKE '%$1%' LOOP
You're assuming plpgsql does variable interpolation in a similar way to
Perl/shell etc. It doesn't. You'll want something like:
...LIKE '%' || $1 || '%'
--
Richard Huxton
Archonet Ltd
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Huxton | 2005-10-17 08:22:16 | Re: Question about functions |
| Previous Message | Sri | 2005-10-17 07:23:04 | Problem while using start transaction ans commit; |