selecting from $1

From: pkelly(at)virtual(dot)org(dot)uk
To: pgsql-general(at)postgresql(dot)org
Subject: selecting from $1
Date: 1999-08-13 10:54:04
Message-ID: Pine.LNX.4.10.9908131151550.30951-100000@virtual.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,
using plpgsql im trying to do a select using $1 as the variable, this is
the query:

CREATE FUNCTION find_user (text) RETURNS text AS '
DECLARE
ip text;
BEGIN
select smtpip into ip from user_services where domain=$1;
IF NOT FOUND THEN
RAISE EXCEPTION ''Cant Find smtpip address for %'',$1;
return;
END IF;
return ip;
END;
' LANGUAGE 'plpgsql';

i get the following error:

ERROR: There is no operator '=$' for types 'varchar' and 'int4'
You will either have to retype this query using an explicit cast,
or you will have to define the operator using CREATE OPERATOR

if i change the =$1 to a 'like' then it works fine..help!

Paul
----------------------------------------------
Paul Kelly pkelly(at)virtual(dot)org(dot)uk
U-NET Internet Noc Some day now!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mario Jorge Nunes Filipe 1999-08-13 11:25:27 moving from 6.3.2 to 6.5
Previous Message Remigiusz Sokolowski 1999-08-13 09:59:52 how to compile postgres with some module