From: | "dayat" <sql(dot)muda(at)yahoo(dot)co(dot)id> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Query with Parameters and Wildcards |
Date: | 2009-04-27 14:47:40 |
Message-ID: | 487E9B6FF30F43DFB2DC0B00E81DAF7A@dayatPC |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Do you run this code in the function? If so, the following example function
with LANGUAGE SQL function:
CREATE OR REPLACE FUNCTION TEST(lastnameVARCHAR)
RETURNS SETOF lanemanager.customers
AS $$
SELECT customercellphone, customercity, customerdatecreated,
customerdatelastmodified, customeremail, customerfax, customerfirstname,
customerid, customerlastname, customermiddleinitial, customerphone,
customerreferredby, customerstateabbr, customerstreet1, customerstreet2,
customersuffix, customertitle, customerworkphone, customerworkphoneext,
customerzip FROM lanemanager.customers WHERE (customerlastname ILIKE $1 ||
'%')
$$
LANGUAGE SQL;
Please tell me is it work for you.
Regards
Hidayat
----- Original Message -----
From: "landsharkdaddy" <ldodd(at)landsharksoftware(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Sent: Monday, April 27, 2009 9:19 PM
Subject: Re: [SQL] Query with Parameters and Wildcards
>
> When I try the following like you suggested I get an error that says
> "operator does not exist: || unknown
>
>
>
> SELECT customercellphone, customercity, customerdatecreated,
> customerdatelastmodified, customeremail, customerfax, customerfirstname,
> customerid, customerlastname, customermiddleinitial, customerphone,
> customerreferredby, customerstateabbr, customerstreet1, customerstreet2,
> customersuffix, customertitle, customerworkphone, customerworkphoneext,
> customerzip FROM lanemanager.customers WHERE (customerlastname ILIKE ||
> '%')
>
>
>
>
>
> landsharkdaddy wrote:
>>
>> I have a query that works on SQL Server to return customers that contain
>> the string entered by the user by accepting parameters and using the LIKE
>> keyword. I would like to move this to postgreSQL but I'm just not sure
>> how
>> to get it done. This is the query
>>
>> SELECT * FROM Customers WHERE FirstName LIKE @custfirst + '%';
>>
>> This works great on SQL Server but not on postgreSQL. Any help would be
>> appreciated.
__________________________________________________
Apakah Anda Yahoo!?
Lelah menerima spam? Surat Yahoo! memiliki perlindungan terbaik terhadap spam
http://id.mail.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Jure Kobal | 2009-04-27 16:29:26 | Re: Query with Parameters and Wildcards |
Previous Message | landsharkdaddy | 2009-04-27 14:19:47 | Re: Query with Parameters and Wildcards |