如何解决这个问题截断不正确的double [英] How to solve this problem truncate incorrect double

查看:212
本文介绍了如何解决这个问题截断不正确的double的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在mysql中执行我的存储过程时,我收到以下错误。我被困了一个小时如何解决这个请帮助我提前感谢。



错误代码:1292。截断不正确的DOUBLE值:'REG



我尝试过:



when i am executing my stored procedure in mysql i am getting below error .i am stuck since an hour how to solve this please help me thanks in advance.

Error Code: 1292. Truncated incorrect DOUBLE value: 'REG

What I have tried:

CREATE DEFINER=`root`@`localhost` PROCEDURE `insert100records`()
begin 
 DECLARE i INT DEFAULT 1;
 declare j int;
 declare name varchar(15);
    WHILE i <= 100 
    DO
    set j=20+i;    
	set name='REG' + cast(j AS char(2))+'2017';
	SELECT name;
    SET i = i + 1;
    END WHILE;
end

推荐答案

最后我得到了解决方案谢谢。在这里,我改变了这样,我得到了





CREATE DEFINER =`root` @`localhost`程序`insert100records`()

开始

DECLARE i INT DEFAULT 1;

声明j int;

声明名称varchar(15);

WHILE i< = 100

DO

set j = 20 + i;

set name = concat('REG',cast(j AS char(2)),'2017');

SELECT name;

SET i = i + 1;

END WHILE;

end
Finally i got the solution thanks. here i changed like this and i got


CREATE DEFINER=`root`@`localhost` PROCEDURE `insert100records`()
begin
DECLARE i INT DEFAULT 1;
declare j int;
declare name varchar(15);
WHILE i <= 100
DO
set j=20+i;
set name=concat('REG',cast(j AS char(2)),'2017');
SELECT name;
SET i = i + 1;
END WHILE;
end


这篇关于如何解决这个问题截断不正确的double的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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