Re: jdbc PreparedStatement using like clause.

2003-12-14 Thread Sven Köhler
ResultSet ivRs = con.createStatement().excuteQuery(select x_id from tbl_y where fname like '%" + param + "%'"); It works as expected How to I implement this as a prepared statement ? An alternative sollution to what Christan suggested should be: ... WHERE fname LIKE '%' & ? & '%' & is the Operat

Re: jdbc PreparedStatement using like clause.

2003-12-13 Thread Michael MacIntyre
Hi Christian. You hit the nail right on the head. Thank you very much. Michael MacIntyre Christian Krone wrote: Hello, Michael MacIntyre had problems with using a like predicate in a prepared statement: [...] where fname like ?"); This executes, returns nothing - it should > ivPs.setString(1,some

Re: jdbc PreparedStatement using like clause.

2003-12-13 Thread Christian Krone
Hello, Michael MacIntyre had problems with using a like predicate in a prepared statement: [...] where fname like ?"); This executes, returns nothing - it should > ivPs.setString(1,someParam); Yes, because a like predicate without surrounding % is like using the = comparison, so the complete fname

jdbc PreparedStatement using like clause.

2003-12-13 Thread Michael MacIntyre
Hello, I am attempting to use prepared statements and am running into some difficulty: I am uncertain of the proper syntax. If I have this query: ResultSet ivRs = con.createStatement().excuteQuery(select x_id from tbl_y where fname like '%" + param + "%'"); It works as expected How to I implemen