0

When I try to pass my arraylist in the SQL IN statement, it is passed as memory location rather than strings.

SELECT Pid FROM details WHERE number IN (" +  tempArrayList.toString().replaceAll("\\[(.*?)\\]", "$1") + ")" ;

But, as I stated in the problem description, it prints

SELECT part_id FROM parts_details WHERE part_number IN ([Ljava.lang.Object;@7bb11784, [Ljava.lang.Object;@1ae369b7)

I have tried some alternatives

  1. Created the array string using StringUtils.Join(tempArrayList.iterator())
  2. Arrays.toString(tempArrayList.get(0)).replaceAll("[\\[\\]]", "") + "','"
Betafish
  • 1,212
  • 3
  • 20
  • 45

0 Answers0