Using? as part of the prepared statement

Possible duplicate:
Can't use a Like query in a prepared JDBC statement?

Is it possible to prepare an SQL statement as follows:

SELECT COUNT(?) FROM TABLE WHERE COLUMUN_1 LIKE '%?%' 

and in Java,

 preparedStmt.setString(1, "COLUMN_2"); preparedStmt.setString(2, "FORD"); 
+4
source share
1 answer

Nope. Typically, you can only use placeholders for values, not identifiers, such as table and column names.

+2
source

Source: https://habr.com/ru/post/1446339/


All Articles