Stored procedure doesn't return expected result.

From: "Stuart Grimshaw" <stuart(dot)grimshaw(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Stored procedure doesn't return expected result.
Date: 2006-02-26 13:17:39
Message-ID: f916d72a0602260517p235e39a7p8bc32d688dc94e10@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm writing a script to clean up some data in a table, the data I'm
using as the source is held in emails, so I've written a perl script
to extract the info. Unfortunatly this email doesn't contain the
client id, so I've written a stored procedure to extract it.

create or replace function get_client_id(text) returns integer as $$
SELECT intclientid FROM client WHERE vchname = '$1';
$$ LANGUAGE SQL;

However, when I do this:

select get_client_id('Stuart Grimshaw');

I get no results, yet:

SELECT intclientid FROM client WHERE vchname = 'Stuart Grimshaw';

Gives me the result I would expect:

intclientid
-------------
3

What am I doing wrong in the stored procedure?

--
-S
http://www.makepovertyhistory.org/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Meskes 2006-02-26 13:23:58 Re: ECPG and COPY
Previous Message Farhad 2006-02-26 12:55:21 Postgre capability