Re: [GENERAL] selecting from $1 - Mailing list pgsql-general

From pkelly@virtual.org.uk
Subject Re: [GENERAL] selecting from $1
Date
Msg-id Pine.LNX.4.10.9908131411290.31803-100000@virtual.org.uk
Whole thread Raw
In response to selecting from $1  (pkelly@virtual.org.uk)
List pgsql-general
hi,
 ahh well how dumb do i feel:)

this doesnt work:
         select smtpip into ip from user_services where domain=$1;
this does:
         select smtpip into ip from user_services where domain = $1;

doh!
Paul

----------------------------------------------
Paul Kelly        pkelly@virtual.org.uk
U-NET Internet Noc    Some day now!

On Fri, 13 Aug 1999 pkelly@virtual.org.uk wrote:

> 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@virtual.org.uk
> U-NET Internet Noc    Some day now!
>
>
>


pgsql-general by date:

Previous
From: Mario Jorge Nunes Filipe
Date:
Subject: Re: [GENERAL] moving from 6.3.2 to 6.5
Next
From: Bart Ogryczak
Date:
Subject: Numeric constants in PostgreSQL?