0

I want to pass array of string to producer. due to i created new Type like bellow.

CREATE OR REPLACE TYPE arrayOfVchr is TABLE of VARCHAR2(100);

and I passed array of string to producer like bellow.

 sp.declareParameters(new SqlParameter("v_array",OracleTypes.ARRAY,"arrayOfVCHR"),
); 

and and added value to it as like this:

 map.addValue("v_array", list,OracleTypes.ARRAY); //or  list.toArray()

but when i execute sp it throw exception.

java.sql.sqlexception fail to convert to internal representation

I'm using spring jdbc

JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.setResultsMapCaseInsensitive(true);
SimpleJdbcCall sp= new SimpleJdbcCall(jdbcTemplate);
Emil
  • 423
  • 1
  • 12
  • 34
  • 1
    Are you using an Oracle driver? Is it JDBC thin or data direct and what version? You need an Oracle driver (not a generic driver) and the type of driver and version can affect what is supported. There is a pure Java snippet in [this answer](https://stackoverflow.com/a/34699771/1509264) for passing an array; can you get something similar working without using Spring producers to make sure it is an issue with using Spring? – MT0 May 30 '18 at 11:32
  • @MT0, thanks for sharing the link, but i'm using `spring jdbc`. please see updated answer. – Emil May 30 '18 at 11:37
  • You seem to have missed the point - if you can get a non-spring solution working with your Spring JDBC driver then you can eliminate the driver (vendor and/or version) as the source of the issue. If you cannot get the non-spring version working with that driver then your issue may be more fundamental than getting the Spring API calls correct as the underlying driver may not support what you are trying to do. – MT0 May 30 '18 at 11:53

0 Answers0