I haven't tried this myself, but my first assumption would be that it simply works as you expect, i.e. the 2nd '?' nested inside the string is not considered to be a parameter marker. If my assumption is wrong, please provide the DB2 version you are using (on which platform) and the exact error message that you are getting.