"Missing IN or OUT parameter at index:: 1" when adding ?' parameters to my query

I have a query constructed in Java to select records, and when constructing with the values ?', I'm getting a missing in and out parameter. If I add only ?, it is working properly.

Here is the query where I am setting the ?' value:

AND 1=fn_contact_account(P.RECORD_ID,'?''%') AND upper( P.PERSON_ID) like ?0 ESCAPE '\' AND NOT (P.PERSON_ID='Unknown')) )
Jon Skeet
people
quotationmark

Parameters aren't substituted into queries textually. I believe the simplest way to do what you want is to just use the ? on its own for the parameter, but add any leading or trailing values to the parameter itself. For example:

 String sql = "SELECT NAME FROM PERSON WHERE NAME LIKE ?";
 try (PreparedStatement pst = conn.prepareStatement(sql)) {
     // Trailing % for "starts with" behaviour
     pst.setString(1, userInput + "%");
     ...
 }

people

See more on this question at Stackoverflow