PreparedStatement: setting column names dynamically

From: Chantal Ackermann <chantal(dot)ackermann(at)web(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: PreparedStatement: setting column names dynamically
Date: 2002-07-26 11:25:55
Message-ID: 3D4131C3.50809@web.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

hello all,

sorry, if this has already been asked:

Is it possible to set column or table names in a PreparedStatement
similar to setting values? I happen to do this very often and in a very
structured way. If it would be possible I could reuse the prepared
statement.

what I mean is:

at the moment I have a query like:

"Select " + column + " from " + table + " where " + column + "=?";

and I would like to have something like:

"Select ? from ? where ?=?";

I see that PreparedStatement doesn't provide any setColumn() methods or
whatever. but there might be some other way I am not aware off, I hope!

Any ideas, suggestions, tips?
Thank you
Chantal

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Elielson Fontanezi 2002-07-26 12:24:24 RES: [JDBC] Java access pgsql sample
Previous Message Dave Cramer 2002-07-26 09:34:07 Re: Give me a hand