Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 7F57F632ECC for ; Mon, 27 Apr 2009 11:48:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20014-07 for ; Mon, 27 Apr 2009 11:48:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp119.mail.sg1.yahoo.com (smtp119.mail.sg1.yahoo.com [124.108.123.218]) by mail.postgresql.org (Postfix) with SMTP id 28802632626 for ; Mon, 27 Apr 2009 11:48:04 -0300 (ADT) Received: (qmail 45099 invoked from network); 27 Apr 2009 14:48:00 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.id; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:From:To:References:In-Reply-To:Subject:Date:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE:X-RFC2646; b=VMB0A7FcPVdNo7V4z1vUnxzY+edhLWxNYhqcRgC/VWwE5klXjKtO2oLYl9k4xWcALRhlJIzc+CBDzfvwyz7kcwZPVdpIbOpCqeoChITzJUuF74HcrSR09QmepWotyiianTo4jErdQejhlqwGe9Cqy9khiFwdJnmKoy6s81r08XE= ; Received: from unknown (HELO dayatPC) (sql.muda@114.59.98.125 with login) by smtp119.mail.sg1.yahoo.com with SMTP; 27 Apr 2009 14:47:59 -0000 X-YMail-OSG: .W.LAEoVM1lrXh8Beyih0_AHv1.XOwog6RHEbP_jkL8I5hfmhzE0gVFUuiXFYg.BqdAOzUhekXm.uFyurj5DTnnz667qNmH9kliTYoMOn3cKVkV6krAJzn6_ainNZGOaYTL3zeDMOLajkWTfSEDNivyVrJfgISyZqGNpcaM.E2ovS5aZi_oKFlIT8NmcbEoPIM4qqkOgyUxOfoJXlexQhPnh6POvGkWPErVNQ.sIwIT1jhc2PuS11hFCzMuwjPB9I1jAYscPNCA- X-Yahoo-Newman-Property: ymail-3 Message-ID: <487E9B6FF30F43DFB2DC0B00E81DAF7A@dayatPC> From: "dayat" To: References: <23248274.post@talk.nabble.com> <23257346.post@talk.nabble.com> In-Reply-To: <23257346.post@talk.nabble.com> Subject: Re: Query with Parameters and Wildcards Date: Mon, 27 Apr 2009 21:47:40 +0700 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049 X-RFC2646: Format=Flowed; Original X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.125 tagged_above=0 required=5 tests=DNS_FROM_RFC_BOGUSMX=2.125 X-Spam-Level: ** X-Archive-Number: 200904/125 X-Sequence-Number: 32471 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" To: 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