I am trying to a run a query with several arrays so i would have to create a query like
SELECT * FROM TABLE_NAME WHERE FIELD1 IN (?,?,?) AND FIELD2 IN(?,?,?) .... SO ON
so, every time i have to generate the number of ?'s based on the size of each array i have and put it there. It seems very old fashioned to me. are there any other ways of doing it? like directly insert an array of values.
I am using java v1.4. I saw something in 1.6 about creating sql arrays but nothing in 1.4
Short of any SQL builder library, you're going to have to generate those multiple bind values yourself. Even with JDBC array support, this is generally not possible, specifically not for Sybase ASE, as far as I know.
By SQL builder library, I mean something like jOOQ (of which I am the developer):
String[] array1 = {"1", "2", "3"};
Integer[] array2 = { 1 , 2 , 3 };
create.select()
.from(TABLE_NAME)
.where(FIELD1.in(array1))
.and(FIELD2.in(array2))
.fetch();
Note that jOOQ requires Java 1.6