连接oracle数据库进行插入数据的过程报错,无效的列类型,null

错误原因:
1、驱动原因
2、插入数据库中的某个字段的值为空(这个可能性高一点)
解决方法:
1、把pom.xml中添加的oracle依赖

<dependency>
	<groupId>com.oracle</groupId>
	<artifactId>ojdbc14</artifactId>
	<version>10.2.0.4.0</version>
	<scope>compile</scope>
</dependency>

改成以下版本

<dependency>
      <groupId>com.hynnet</groupId>
      <artifactId>oracle-driver-ojdbc6</artifactId>
      <version>12.1.0.1</version>
</dependency>

2、调试检查自己插入的数据是否有为空的,如果需求上是存在为空的数据,建议在.xml中的sql语句写上判断

insert into TB_NAME (
      <if test="id!= null and id!=''" >
        ID
      </if>
)
values(
	<if test="id!= null and id!=''" >
      #{id},
	</if>
)

猜你喜欢

转载自blog.csdn.net/weixin_40626699/article/details/85061315