mysql更新数据提醒Truncated incorrect INTEGER value:错误

小浪SEO博客 专注SEO优化思维、SEO技术的实战分享类博客~

在mysql中更新数据时出现了Truncated incorrect INTEGER value错误,但仔细查看语句没什么问题,于时又运行还是有错,然后直接利用phpmyadmin生成一条才发现php用多了直接把习惯放在了mysql中.

在网上都找不到什么解决的方法,但是百度到一个个人博客后找到了解决的方法,报错的sql语句,代码如下:

update xx user set qq_password = 'xx_id' & photo = 'img' WHERE email = 'emailx'

然后这个是正确的执行语句,代码如下:

update xx user set qq_password = 'xx_id',photo = 'img' WHERE email = 'emailx'

把&改为,逗号就好了,后来看一老外使用存储过得也碰到这样的问题.

Truncated incorrect INTEGER value:'1|Blondes'

存储过程函数,代码如下:

  1. DELIMITER$$
  2. DROPFUNCTIONIFEXISTS`fnObjectTagGetObjectTags`$$
  3. CREATEDEFINER=`root`@`%`FUNCTION`fnObjectTagGetObjectTags`(_objectTypeint,_objectIdbigint)RETURNSvarchar(2048)CHARSETutf8
  4. BEGIN
  5. DECLARE_outObjectTagsVARCHAR(2048);
  6. SET_outObjectTags=
  7. (
  8. SELECT(CAST(GROUP_CONCAT(CONCAT(tagId,'|',tagName)separator'~')ASCHAR(10000)CHARACTERSETutf8))ASobjectTagList
  9. FROM
  10. (
  11. SELECTtagId,tagName
  12. FROMobjectTag
  13. INNERJOINtag
  14. ONtagId=objectTagTagId
  15. WHEREobjectTagObjectType=_objectType
  16. ANDobjectTagObjectId=_objectId
  17. ANDobjectTagIsDisabled=0
  18. ANDobjectTagIsActive=1
  19. ANDtagIsDisabled=0
  20. ANDtagIsActive=1
  21. )assubQuery
  22. );
  23. RETURN_outObjectTags;
  24. END$$
  25. DELIMITER;

使用过程,代码如下:

  1. SELECTfnObjectTagGetObjectTags(3,album.albumId)
  2. FROMalbum
  3. WHEREfnObjectTagGetObjectTags(3,album.albumId)ISNOTNULL
  4. ANDalbumIsDisabled=0
  5. ANDalbumIsActive=1
  6. TryanexplicitcastofjustthetagIdwww.phpfensi.comasacharacterbeforetheconcatenation,sinceyoumaybemixingbinaryandnon-binarystrings.Like
  7. SELECT(CAST(GROUP_CONCAT(CONCAT(CAST(tagIdASCHAR),'|',tagName)separator'~')ASCHAR(10000)CHARACTERSETutf8))

相关广告
  • mysql更新数据提醒Truncated incorrect INTEGER value:错误 mysql更新数据提醒Truncated incorrect INTEGER value:错误 mysql更新数据提醒Truncated incorrect INTEGER value:错误
相关阅读

mysql更新数据提醒Truncated incorrect INTEGER value:错误

2019/10/10 17:37:14 | 谷歌SEO算法 | 5G标准出炉