0

I have the following prepared statement.

"select * from gfc.LSI_ELGBLTY where INSURANCE_ID = ? and SYS_CD = ? and ACCT_TYPE in (?)";

how can i append single quote before and after ? for eg after passing params to the query, it should be like

"select * from gfc.LSI_ELGBLTY where INSURANCE_ID = '1234' and SYS_CD = 'AA' and ACCT_TYPE in 'SDF'";
Chiche
  • 11
  • 5
  • 2
    You don't add single quotes for placeholders in prepared statements, they get added automatically when needed (e.g for varchar, date types ..). – Arnaud Sep 21 '18 at 12:11

2 Answers2

2

You are not supposed to do it yourself, this is done either client-side by the JDBC driver or server-side by the database instance. Take a look at How does the MySQL JDBC driver handle prepared statements article to understand how it works.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
0

Adding backslash would help.
\'?\'

Haripriya
  • 822
  • 1
  • 14
  • 27