IN clause with PreparedStatement

From: Ingmar Lötzsch <iloetzsch(at)asci-systemhaus(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: IN clause with PreparedStatement
Date: 2007-07-18 15:42:30
Message-ID: 469E34E6.3010002@asci-systemhaus.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I want to submit a query like

SELECT *
FROM table1
WHERE id IN (1, 2, 3);

whereas the list 1, 2, 3 must be created dynamically. The goal is to
avoid n queries for single objects instead of one query. I can
concatenate the statement and use Statement. But I can't figure out, how
to use PreperedStatement. Can you help me?

Thank you, Ingmar

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tonio Caputo 2007-07-18 17:19:31 Re: Index scan with like expressions
Previous Message Kalle Hallivuori 2007-07-18 14:20:07 Re: Stream Copy for 8.1 - 8.3dev