A column or character expression is larger than the max size.

Database
Enthusiast

A column or character expression is larger than the max size.

I am trying to concat two strings inside a stored procedure and getting this "A column or character expression is larger than the max size" error.

here is the basic outline of my code. I would really appreciate some suggestion on this problem

 

 

REPLACE PROCEDURE db_name.proc_name ()
BEGIN
Declare stmt1 varchar(64000);
DECLARE stmt2 varchar(64000);
DECLARE stmt3 varchar(64000);

set stmt1 = 'stmt1';
set stmt2 = 'stmt2' ;
set stmt3 = stmt1||stmt2;
END;

 

 


Accepted Solutions
Senior Apprentice

Re: A column or character expression is larger than the max size.

The parser checks the defined not the actual length and 64000 + 64000 is twice the maximum size of 64000. 

Simply decrease the defined size.

1 ACCEPTED SOLUTION
2 REPLIES
Senior Apprentice

Re: A column or character expression is larger than the max size.

The parser checks the defined not the actual length and 64000 + 64000 is twice the maximum size of 64000. 

Simply decrease the defined size.

Enthusiast

Re: A column or character expression is larger than the max size.

Thanks. I also found that out. reducing varchar size solves the problem