I\'d like to create a JDBC PreparedStatement like:
SELECT URL,LOCATE ( \'?\', URL ) pos FROM Links WHERE pageId=? ORDER BY pos ASC
Where the 1s
The meaning of the ?
is specified in the SQL specification, and the JDBC specification defers to the SQL specification for this.
A driver doesn't (and shouldn't) interpret a question mark in a literal as a parameter placeholder, as a question mark within a string literal is simply a character within the string literal. For more information look at chapter 5 of SQL:2011 Foundation (ISO-9075-2:2011).
So escaping is not necessary (nor possible).