Why do I get a data conversion error when merging an array (where update works fine)?
// Data conversion error converting
// "'[5, 6]' (B: ""ISET"" INTEGER ARRAY)"
MERGE INTO B
USING VALUES (?) _v(arr)
ON B.id IN(1)
WHEN MATCHED THEN
UPDATE SET arr = _v.arr
WHEN NOT MATCHED THEN
INSERT (arr) VALUES (_v.arr)
// works
UPDATE B
SET arr = ?
WHERE B.id IN(1)
It seems like the array is received like a text string for the merge although I prepare the array the same way for both update and merge:
preparedStatement.setArray(1, connection.createArrayOf("INT", Array(5, 6))
Do I need to add a cast somewhere for arrays or what am I doing wrong?