• MyBatis内SQL语句报错
  • 其它

<insert id="insertSelectiveAndTreturnId" parameterType="com.binhai.fix.bean.FixBean"
  useGeneratedKeys="true" keyProperty="id">
   insert into t_fix
   <trim prefix="(" suffix=")" suffixOverrides="," >
     <if test="id != null" >
       id,
     </if>
     <if test="describe != null" >
       describe,
     </if>
     <if test="subDate != null" >
       subDate,
     </if>
     <if test="finDate != null" >
       finDate,
     </if>
     <if test="phone != null" >
       phone,
     </if>
     <if test="shifoushanchu != null" >
       shifoushanchu,
     </if>
   </trim>
   <trim prefix="values (" suffix=")" suffixOverrides="," >
     <if test="id != null" >
       #{id,jdbcType=INTEGER},
     </if>
     <if test="describe != null" >
       #{describe,jdbcType=VARCHAR},
     </if>
     <if test="subDate != null" >
       #{subDate,jdbcType=VARCHAR},
     </if>
     <if test="finDate != null" >
       #{finDate,jdbcType=VARCHAR},
     </if>
     <if test="phone != null" >
       #{phone,jdbcType=INTEGER},
     </if>
     <if test="shifoushanchu != null" >
       #{shifoushanchu,jdbcType=INTEGER},
     </if>
   </trim>
 </insert>
报错:
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'describe,




       phone )
    values ( '111',
   ' at line 2
### The error may involve com.binhai.fix.dao.FixBeanDao.insertSelectiveAndTreturnId-Inline
### The error occurred while setting parameters
### SQL: insert into t_fix      ( describe,                                     phone )       values ( ?,                                     ? )
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'describe,




       phone )
    values ( '111',
   ' at line 2
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'describe,




       phone )
    values ( '111',
   ' at line 2
   at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)

  • Willson1991    2020-01-13 11:29:08
  • 阅读 1021    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信