title: MySQL, Problem using CONCAT in stored procedure
body: <p><strong>I am having a problem using CONCAT() in a MySQL procedure.</strong></p>
  <p>I am using MySQL version: 8.0.22</p>
  <p>From the command line, CONCAT works for the following two scenarios.  So, it appears to me that I should be able to use one of these formats in a procedure.</p>
  <pre><code>root@localhost [mdy_exp_constraints]&gt; SET @primary_color_name = 'yellow';
  Query OK, 0 rows affected (0.00 sec)
  
  root@localhost [mdy_exp_constraints]&gt; SELECT CONCAT('Data too short for ', @primary_color_name, ' column.');
  +----------------------------------------------------------------+
  | CONCAT('Data too short for ', @primary_color_name, ' column.') |
  +----------------------------------------------------------------+
  | Data too short for yellow column.                              |
  +----------------------------------------------------------------+
  1 row in set (0.00 sec)
  
  
  root@localhost [mdy_exp_constraints]&gt; SET @woof =  CONCAT('Data too short for ', @primary_color_name, ' column.');
  Query OK, 0 rows affected (0.00 sec)
  
  root@localhost [mdy_exp_constraints]&gt; SELECT @woof;
  +-----------------------------------+
  | @woof                             |
  +-----------------------------------+
  | Data too short for yellow column. |
  +-----------------------------------+
  1 row in set (0.00 sec)
  </code></pre>
  <p><strong>This is the data that I use to test my procedure</strong></p>
  <ul>
  <li>This is good data.  So, no errors to report.</li>
  </ul>
  <pre><code>CALL mdy_exp_constraints.checkColorsForTooFewChars('red', 'ff');
  Query OK, 0 rows affected (0.00 sec)
  </code></pre>
  <ul>
  <li>This is bad data because the data is too long for <code>IN primary_color_value CHAR(2)</code>.  This error is handled by the MySQl server.</li>
  </ul>
  <pre><code>CALL mdy_exp_constraints.checkColorsForTooFewChars('green', 'fff');
  ERROR 1406 (22001): Data too long for column 'primary_color_value' at row 1
  </code></pre>
  <ul>
  <li>This is bad data because the data is too short for CHAR(2).  <strong>What I am trying to do is to report this error.  BUT, it does not seem to like how I am using CONCAT() in a procedure.</strong></li>
  </ul>
  <pre><code>CALL mdy_exp_constraints.checkColorsForTooFewChars('blue', 'a');
  ERROR 1644 (45000): Data too short for column.
  </code></pre>
  <p>Below, I define my procedure.</p>
  <pre><code>CREATE SCHEMA mdy_exp_constraints
  DEFAULT CHARACTER SET utf8mb4
  COLLATE utf8mb4_0900_ai_ci;
  
  USE mdy_exp_constraints;
  
  
  DROP PROCEDURE IF EXISTS mdy_exp_constraints.checkColorsForTooFewChars;
  SHOW COUNT(*) WARNINGS;
  SHOW WARNINGS;
  
  
  # -- SHOW all PROCEDUREs for the specified database.
  SHOW
      PROCEDURE STATUS
  WHERE
      db = 'mdy_exp_constraints'\G
  
  
  DELIMITER $
  
  CREATE PROCEDURE checkColorsForTooFewChars(
      IN primary_color_name VARCHAR(32),
      IN primary_color_value CHAR(2)
  )
  BEGIN
      DECLARE required_str_length TINYINT;
      SET required_str_length = 2;
  
      IF CHAR_LENGTH(primary_color_value) &lt; required_str_length THEN
          SIGNAL SQLSTATE '45000'
              SET MESSAGE_TEXT = CONCAT('Data too short for ', primary_color_name, ' column.');
              -- SET MESSAGE_TEXT = 'Data too short for column.';
      END IF;
  END $
  
  DELIMITER ;
  </code></pre>
  <p>And this is the error that I am receiving.</p>
  <pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('Data too short for ', primary_color_name, ' column.');
              
      END IF' at line 11
  </code></pre>
  <p>If I comment out the line that contains the CONCAT() and un-comment the line not containing the CONCAT(), this procedure works when running it against the test data...except, that it will not report the <code>primary_color_name</code>, which is what I would like for it to do.</p>
  <p>Thanks,</p>
  <p>Mike</p>