H
Hans Bijvoet
In Java, I have the following code snippet:
PreparedStatement ps = conn.prepareStatement("INSERT INTO ? (price) VALUES
(?)");
ps.setString(1, tableName); // tableName = article
ps.setFloat(2, price); // price = 12.24
ps.executeUpdate();
This will raise a SQLException because the sql-string becomes: INSERT INTO
"article" (price) VALUES (12.24).
How can I avoid that the tablename is surrounded by quote's?
Greetings,
Hans
PreparedStatement ps = conn.prepareStatement("INSERT INTO ? (price) VALUES
(?)");
ps.setString(1, tableName); // tableName = article
ps.setFloat(2, price); // price = 12.24
ps.executeUpdate();
This will raise a SQLException because the sql-string becomes: INSERT INTO
"article" (price) VALUES (12.24).
How can I avoid that the tablename is surrounded by quote's?
Greetings,
Hans