0

I tried this :

@Select("SELECT * FROM TABLENAME WHERE PRDCR_ID IN "
      + "FOREACH item= 'item'  index= 'index' collection= 'childScanIDs' separator=',' open='(' close=')'> #{item}  </FOREACH>") 
abstract List<String>  getCompanydetails(@Param("childScanIDs")  List<String> childScanIDs, @Param("groupName") String groupName);

And I got the error below:

Could not set parameters for mapping: 

ParameterMapping{property='childScanIDs', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}.

Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null .

Try setting a different JdbcType for this parameter or a different configuration property.

Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null .

Try setting a different JdbcType for this parameter or a different configuration property.

Cause: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=.;;, FROM INTO, DRIVER=4.14.137

mao
  • 11,321
  • 2
  • 13
  • 29
  • There is an obvious mistake (missing open foreach tag) and inconsistent error messages in the question. I would suggest you to create a small demo project like [these](https://github.com/harawata/mybatis-issues) that reproduces the exception and share it on your GitHub repo. – ave Jun 15 '21 at 07:28
  • I have faced same issue. "SELECT DISTINCT RTRIM(sa_bd_cd) as SA_BD_CD, FROM DB2TADM.VGZ_AGT_PRDCR_INFO WHERE PRDCR_ID IN " + " #{item}" – Anbukarthik Jun 20 '21 at 04:24
  • I'm not sure if it's the only problem, but the entire statement must be enclosed in ` – ave Jun 20 '21 at 07:00
  • Yes i have used – Anbukarthik Jun 22 '21 at 06:14

0 Answers0