Crate IN operator and args value

110 Views Asked by At

I am unable to send the String[] or List as an args to the "IN" operator. Can you please suggest me how to send the an input value for IN operator using crate java client.

1

There are 1 best solutions below

2
On

it depends on what you are trying to achieve, IN only takes arbitrary length function parameters, which (assuming you want to use the '?' parameter substitution) does not take any array/list/other collection, but single values: For example select * from information_schema.tables where schema_name in (?, ?, ?); would be translated into select * from information_schema.tables where schema_name in ('a', 'doc', 'b'); when the parameters were ['a', 'doc', 'b']. See also: https://crate.io/docs/reference/sql/queries.html#in

If you want to check if a value was is an array, ANY() could work for you: https://crate.io/docs/reference/sql/queries.html#any-array - it should take an array as parameter.

Hope that helps!

Claus