无法通过执行存储过程将表情符号插入表中

时间:2018-05-31 09:56:35

标签: mysql

当我执行下面的查询时,我得到的值如下表所示。

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

"Variable_name"             "Value"
"character_set_client"      "utf8mb4"
"character_set_connection"  "utf8mb4"
"character_set_database"    "utf8mb4"
"character_set_filesystem"  "binary"
"character_set_results"     "utf8mb4"
"character_set_server"      "utf8mb4"
"character_set_system"       "utf8"
"collation_connection"       "utf8mb4_general_ci"
"collation_database"        "utf8mb4_unicode_ci"
"collation_server"          "utf8mb4_general_ci"

当我拨打stored procedure时,我收到如下错误

**Incorrect string value: '\xF0\x9F\x8D\x89\xF0\x9F...' for column 'p_caption' at row 1**

当我执行以下查询时,值将被插入

INSERT INTO `orderdetails` (`OrderDetailsID`,`OrderId`,`Caption`)
VALUES('123456789','a1b16d012dcff03af923005ef9f98eb5','Happy birthday dear Ryan,,❤️')

但是当我试图调用下面的存储过程时,它不起作用

CALL `sp_SaveOrderDetails`('123456789', 'a1b16d012dcff03af923005ef9f98eb5','Happy birthday dear Ryan,,❤️')

stored procedure如下

CREATE PROCEDURE `sp_SaveOrderDetails`(IN p_orderDetailsID VARCHAR(40), IN p_orderId VARCHAR(40), IN p_caption TEXT)
BEGIN
    INSERT INTO `orderdetails` (`OrderDetailsID`,`OrderId`,`Caption`)
    VALUES('123456789','a1b16d012dcff03af923005ef9f98eb5','Happy birthday dear Ryan,,❤️')
   END$$

DELIMITER ;

使用上述查询将值插入到表中,但在通过stored procedure调用时它不起作用。我使用字段类型TEXT。我是mysql的新手。任何人都可以帮忙

0 个答案:

没有答案