{"title":"导入数据一共【10】行","description":"导入10行数据到数据库时,遇到了SQL语法错误,错误信息显示在VALUES子句中存在语法错误。","keywords":"SQL语法错误, 导入数据, VALUES子句, MySQL, 数据库","content":"Creating a new SqlSession\nSqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1f11ecf5] was not registered for synchronization because synchronization is not active\n19-Jul-2023 10:24:19.738 淇℃伅 [http-nio-8080-exec-6] com.alibaba.druid.pool.DruidDataSource.info {dataSource-1} inited\nJDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@17926a61] will not be managed by Spring\n==> Preparing: insert into spareplan( dec_as_num, item_num, item_name, item_detail, model, capacity, storage_status, storage_num, outbound_status, outbound_num, dispatch_status, plan_status item ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) \n==> Parameters: null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null\nClosing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1f11ecf5]\n19-Jul-2023 10:24:20.427 淇℃伅 [http-nio-8080-exec-6] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]\norg.springframework.jdbc.BadSqlGrammarException: \n19-Jul-2023 10:24:20.457 淇℃伅 [http-nio-8080-exec-6] org.springframework.jdbc.support.SQLErrorCodesFactory. SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]\n### Error updating database. Cause: java.sql.SQLSyntaxErrorException: 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 'item\n )\n values\n \n (\n null,\n ' at line 14\n### The error may involve com.xm.mapper.SparePlanMapper.addSparePlanInfo-Inline\n### The error occurred while setting parameters\n### SQL: insert into spareplan( dec_as_num, item_num, item_name, item_detail, model, capacity, storage_status, storage_num, outbound_status, outbound_num, dispatch_status, plan_status item ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? ) , ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ? )\n### Cause: java.sql.SQLSyntaxErrorException: 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 'item\n )\n values\n \n (\n null,\n ' at line 14\n; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: 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 'item\n )\n values\n \n (\n null,\n ' at line 14\n怎么解决什么意思内容:根据提供的错误信息,问题出现在SQL语句的语法错误。具体来说,在VALUES子句中存在错误。\n\n解决方法:\n1. 仔细检查SQL语句的语法,确保每个字段都以逗号分隔,并且每个字段的值都与其对应的数据类型匹配。\n2. 检查VALUES子句中的占位符数量和实际提供的参数数量是否匹配。\n3. 检查SQL语句中是否存在不必要的空格或多余的字符。\n4. 确保使用了正确的MySQL语法,根据MySQL服务器版本的要求进行相应的修改。\n\n如果问题仍然存在,请提供完整的SQL语句和相关的数据,以便我们能够更好地帮助您解决问题。\n

导入数据出错:SQL语法错误 - 解决方法

原文地址: https://www.cveoy.top/t/topic/pTSD 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录