I have this code
But it outputsCode:public class HelloWorld { public static void main(String[] args) { Object[] param = new Object[] {"some_value"}; System.out.println(MessageFormat.format("select * from test where column1 = '{0}'", param)); } }
select * from test where column1 = {0}
and I need select * from test where column1 = 'some_value'
Oh ok, I can get it to haveand outputs fine. But is there any way I can have the single quote on the .format's parameter? I mean, given by someone I can have some_value to be a final static String member, so I guess it would be better if single quote is on .format method parameter string.Code:Object[] param = new Object[] {"'some_value'"}; System.out.println(MessageFormat.format("select * from test where column1 = {0}", param));
Thanks in advance!




Reply With Quote