如何使用存储过程在MySQL中插入Unicode数据 [英] How to Inserting Unicode data In MySQL using Stored Procedures

查看:393
本文介绍了如何使用存储过程在MySQL中插入Unicode数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个应用程序。使用Fronde vs 2010并支持MySQL 5.3版本。这个应用程序我在MySQL使用存储过程。我在英语中插入数据它的工作。但我插入Unicode日期(如Marathi或Hindi) )生成相同的存储过程错误。错误是: - 第1行的'p_hindicontent'列的字符串值不正确:'\ xE0 \ xA4 \ x90 \ xE0 \ xA4 ...'



请帮帮我。

谢谢你在Advances

I had created one application.used Fronde vs 2010 and backed MySQL 5.3 version.this application i am used store-procedure in MySQL .i am insert data in English it's work.but i am insert Unicode date (like Marathi or Hindi) on same stored-procedure error's is generated. The error is :-"Incorrect string value: '\xE0\xA4\x90 \xE0\xA4...' for column 'p_hindicontent' at row 1"

Pleases help me.
Thank you in Advances

推荐答案

你需要选择UTF8作为字符集或整理时您创建列:

You need to select UTF8 as teh character set or collation when you create the column:
CREATE TABLE MyTable
   (
   ...
   MyColumn CHAR(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci
   ...
   )


你写这样的存储过程



DROP PROCEDURE IF EXISTS`cn_marathidata``SPemp`
you to write the stored procedure like this

DROP PROCEDURE IF EXISTS `cn_marathidata`.`SPemp`




CREATE DEFINER =`root` @`localhost` PROCEDURE`SPemp`(

in P_name text charset utf8,

in P_address text charset utf8



BEGIN

INSERT INTO Employee



名称,

地址





VALUES



P_name,

P_address

);

END

CREATE DEFINER=`root`@`localhost` PROCEDURE `SPemp`(
in P_name text charset utf8,
in P_address text charset utf8
)
BEGIN
INSERT INTO Employee
(
name,
address

)
VALUES
(
P_name,
P_address
);
END


这篇关于如何使用存储过程在MySQL中插入Unicode数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆