1366 - Incorrect string value: '\xE4\xB8\xAD\xE6\x96\x87' for column 'cName' at row 1
来源:互联网 发布:70古稀80知天命 编辑:程序博客网 时间:2024/05/17 01:53
1.解释:
这是一个自定义的Mysq函数在运行时候所报的错误
2.Mysql的函数:
CREATE FUNCTION `getClassName`(classId INTEGER)
RETURNS varchar(50) CHARSET utf8
DETERMINISTIC
BEGIN
DECLARE cName VARCHAR(50) DEFAULT '';
SELECT `name` INTO cName from class where cid=classId;
RETURN cName;
END;
3.分析:
报错的含义就是此函数在第一行定义的cName这个字段被赋予了错误的字符串值:'\xE4\xB8\xAD\xE6\x96\x87'
实际上就函数里面的变量接收到的值跟它定义的不一致,但是一看还是varchar类型为什么会不一致呢?
再仔细检查它被赋予的值里面一定是有中文在里面的,所以问题就在于中文,要解决这个问题就需要让cName这个变量可以接收中文才行,于是把上面的cName声明修改如下:
CREATE FUNCTION `NewProc`(classId INTEGER)
RETURNS varchar(50) CHARSET utf8
DETERMINISTIC
BEGIN
DECLARE cName VARCHAR(50) CHARSET utf8 DEFAULT '';
SELECT `name` INTO cName from class where cid=classId;
RETURN cName;
END;
就是在声明cName的后面给它指定了编码格式:CHARSET utf8
再次运行此函数,结果中有中文也不会报错了。
- 1366 - Incorrect string value: '\xE4\xB8\xAD\xE6\x96\x87' for column 'cName' at row 1
- MySQL 执行插入操作时报1366 - Incorrect string value: '\xE4\xB8\xAD\xE6\x96\x87' for column 'name' at row 1
- Incorrect string value: '\xE4\xB8\xAD\xE7\xBA\xA7' for column 'title' at row 1
- ERROR 1366 (HY000): Incorrect string value: '\xE4\xB8\xAD\xE5\x9B\xBD' for column 'tname' at row 1
- Incorrect string value: '\xE4\xB8\x80\xE7\xBA\xA7...' for column 'name' at row 1
- failed:Incorrect string value: '\xE5\xBC\xA0\xE4\xB8\x89' for column 'name' at row 1
- Incorrect string value: '\xE9\x98\xBF\xE6\x96\xAF...' for column 'name' at row 1 form表单提交乱码
- \xe4\xb8\xad\xe6\x96\x87 phython 字符编码乱码问题
- ERROR 1366 (HY000): Incorrect string value: '\xE5\xB8\x82' for column 'address' at row 1
- ERROR 1366 (HY000): Incorrect string value: '\xE5\xB8\x82' for column 'address' at row 1
- 彻底解决:Incorrect string value: '\xF0\x9F\x98\xAD",...' for column 'commentContent' at row 1
- Incorrect string value: '\\xE7\\x9B\\xB8\\xE5\\x90\\x8C...' for column 'comment' at row 1
- ERROR 1366 (HY000): Incorrect string value: '\xE4\xB8\x8D\xE5\xA5\xBD' for column 'description' at r
- Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column 'xxx' at row 1
- Incorrect string value: '\xE4\xBC\x9A\xE5\x91\x98' for column 'recipient' at row 1
- mysql:Incorrect string value: '\xE5\x8C\x97\xE4\xBA\xAC' for column 'address' at row 1
- 错误信息:Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column 'name' at row 1
- Incorrect string value: '\xE6\x88\x91' for column 'username' at row 1
- Easyui Datagrid IE8下数据加载很慢,IE会被卡住的直接原因
- DS1602液晶显示程序代码
- 基于V4L2的视频驱动开发(2
- SVN与SCM
- Linux命令
- 1366 - Incorrect string value: '\xE4\xB8\xAD\xE6\x96\x87' for column 'cName' at row 1
- oracle用户管理、备份及恢复
- 将你的代码迁移到Objective-C ARC
- C# 学习笔记:关于string与stringbuilder的区别
- 抽象类 & 接口& 虚函数&纯虚函数&非虚函数
- 数据结构
- TCP/IP Monitor监控工具应用
- ubuntu 13.10 eclipse
- STM8S20X的OPTION BYTE地址区间