X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00A6F5281A for ; Mon, 13 Jun 2005 10:07:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11983-09 for ; Mon, 13 Jun 2005 13:07:14 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id A67425292F for ; Mon, 13 Jun 2005 10:07:12 -0300 (ADT) Received: (qmail 24541 invoked from network); 13 Jun 2005 13:05:22 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (64.7.143.116) by net2.micro-automation.com with SMTP; 13 Jun 2005 13:05:22 -0000 In-Reply-To: <42AD8567.10004@tnet.dp.ua> References: <42AD8567.10004@tnet.dp.ua> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <18349492-DC94-4DA4-B924-0FFC02F6A95B@fastcrypt.com> Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: in(...) clause and PreparedStatement Date: Mon, 13 Jun 2005 09:07:11 -0400 To: Sergey Pariev X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/60 X-Sequence-Number: 13022 Yes, because it thinks "1,2,3" is a string you would have to do IN(?,?,?) then setObject(1, 1); setObject(2, 2); setObject(3, 3); Dave On 13-Jun-05, at 9:08 AM, Sergey Pariev wrote: > Hi all. > It may be stupid question, but is there way to use > PreparedStatement with queries like > SELECT * FROM mytable WHERE t_id IN (1,2,3) ? > I've googled but haven't found nothing explicitly said on this > topic. > I've tried the following > PreparedStatement st = conn.prepareStatement("SELECT * FROM > mytable WHERE t_id IN ( ? )"); > st.setObject(1,"1,2,3"); > > and get error complaining on type mismatch. > > Thanks in advance, Sergey. > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) > >