开发者

MySql SP - Data too long error

开发者 https://www.devze.com 2023-02-18 18:04 出处:网络
I have created a SP in MySql, where an input parameter ha开发者_C百科ve longText type. I want to pass 12,000 characters into that sp. But it gives me an error - \"Data too long for column \'inputPar

I have created a SP in MySql, where an input parameter ha开发者_C百科ve longText type.

I want to pass 12,000 characters into that sp. But it gives me an error - "Data too long for column 'inputParam' at row 1".

Can someone help me?


drop procedure if exists foo;
delimiter #

create procedure foo(in p_string longtext)
begin
select length(p_string) as len;
end#

delimiter ;

set @s = '5,14,16,20,34,38,39,41,45,53,59,61,63,....');

call foo(@s);

+-------+
| len   |
+-------+
| 14479 |
+-------+
1 row in set (0.00 sec)

see http://pastie.org/1685774 for full script !


Well the TEXT type for mysql can contain a maximum length of 4,294,967,295 chars. So passing in 12,000 chars into a type LONGTEXT should definitely work. There must be something else wrong with your statement. Could You please post your SP and the call you are making to it?

0

精彩评论

暂无评论...
验证码 换一张
取 消