Click here to Skip to main content
16,011,957 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:

SQL
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
Posted
Updated 5-Oct-17 20:18pm
v2

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900