What does it mean? ORA-06502: PL/SQL: numeric or value error: character string buffer too small
As stated in the comments, both errors have been caused by declaring @error_msg varchar where it should have been ,@error_msg varchar(max)