Reputation: 24676
Is there a way to parametrize fields of a SELECT statement using PreparedStatement
or other utilities?
I mean something like:
SELECT ?, ? FROM MY_TABLE WHERE ? = ?
Upvotes: 1
Views: 170
Reputation: 3821
Try with the following
http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html
Upvotes: 1
Reputation: 726599
No, JDBC does not let you do that. The idea behind parameters is to speed up execution and avoid SQL interjections; parameterizing the columns that you are selecting does not help either of these two goals.
Upvotes: 1