Mybatis配置jdbcType无效,提示JdbcType=null

XML文件中配置如下

    <insert id="insertMSG" parameterType="com.test.XXX">
        insert into XXXXXX (msg_def_id)
        select 
               #{msg_def_id,jdbcType=VARCHAR} from dual
    </insert>

发生报错:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='msg_def_id', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #3 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: 无效的列索引

报错的意思是非空值并不能使用JdbcType=null,可问题是这里已经给这个字段配置了jdbcType=VARCHAR,请问这是什么原因?数据库是oracle

com.test 这玩意儿是啥,多半是包路径,不是实体路径

img


插入语句,少了个values

#{msg_def_id,jdbcType=VARCHAR} 是什么?
你是想将从 dual 表中查出来的指定字段的记录值插入到 XXXXXX 表中对应的字段中对吗?
msg_def_id是dual表中的字段名,
你可以试下这个

<sql id="BASE_DICE_COLUM">
     你要查询的dual表中的字段,例如 id,name,age 等等
  </sql>
 <insert id="insertMSG" parameterType="com.test.XXX">
        insert into XXXXXX (msg_def_id) select  <include refid="BASE_DICE_COLUM"/>  from dual
    </insert>