Reputation: 1409
I am new to MySQL stored procedures and for the beginning purposes i created this little procedure. Simply take an input, concatinate "Hi! " with it and assign to OUT p2. What I am doing wrong?
CREATE DEFINER=`root`@`localhost` PROCEDURE `testing`(IN `p1` CHAR(50), OUT `p2` TEXT)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT 'this is comment'
BEGIN
set p2 = "Hi! " + p1;
END
When I call procedure using
CALL `testing`('Joe', @p);
select @p;
It gives me warning
Truncated incorrect double value: 'Hi!'
Truncated incorrect double value: 'Joe'
Any help for a beginner will be appreciated.
Upvotes: 0
Views: 67
Reputation: 3756
Write procedure like this
CREATE DEFINER=`root`@`localhost` PROCEDURE `testing`(IN `p1` CHAR(50), OUT `p2` TEXT)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT 'this is comment'
BEGIN
set p2 = CONCAT("Hi! " , p1);
END
Upvotes: 1