0

Can you please let me know what I am doing wrong here with update statement in stored procedure using concat?

DELIMITER ;;
CREATE PROCEDURE `update_data`(IN loc INT)
BEGIN
update cart set location = concat('999999999', loc) where location = loc;
END;;
DELIMITER ;

When I run this I am not getting a different number than I am trying to update.

call update_data(1);

Here is my result from location

2147483647

I was expecting 9999999991.

Any ideas?

VKA
  • 209
  • 1
  • 7
  • 16
  • 1
    May be this is related http://stackoverflow.com/questions/23550231/long-integer-is-transformed-when-inserted-in-shorter-column-not-truncated-why – Oto Shavadze Apr 08 '17 at 17:22
  • Maybe your DB is not configured for made autocommit. So, you have to add COMMIT at the end of the sentence. – fingerprints Apr 08 '17 at 17:31
  • 1
    `9999999991 > 2147483647`. See [12.2.1 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT](https://dev.mysql.com/doc/refman/5.7/en/integer-types.html) and [12.2.6 Out-of-Range and Overflow Handling](https://dev.mysql.com/doc/refman/5.7/en/out-of-range-and-overflow.html). – wchiquito Apr 08 '17 at 17:38

0 Answers0