it shows me the following error:
DB Execute Failed. ERROR: value too long for type character varying(3) CONTEXT: SQL statement
"INSERT INTO STUDENT_MP_STATS (student_id, marking_period_id, sum_weighted_factors, sum_unweighted_factors, grade_level_short, cr_weighted_factors, cr_unweighted_factors, gp_credits, cr_credits) select srcg.student_id, (srcg.marking_period_id::text)::int, sum(weighted_gp*credit_attempted/gp_scale) as sum_weighted_factors, sum(unweighted_gp*credit_attempted/gp_scale) as sum_unweighted_factors, (select eg.short_name from enroll_grade eg, marking_periods mp where eg.student_id = s_id and eg.syear = mp.syear and eg.school_id = mp.school_id and eg.start_date <= mp.end_date and cast(mp.marking_period_id as text) = mp_id order by eg.start_date desc limit 1) as short_name, sum( case when class_rank = 'Y' THEN weighted_gp*credit_attempted/gp_scale END ) as cr_weighted, sum( case when class_rank = 'Y' THEN unweighted_gp*credit_attempted/gp_scale END ) as cr_unweighted, sum(credit_attempted) as gp_credits, sum(case when class_rank = 'Y' THEN credit_attempted END) as cr_credits from student_report_card_grades srcg where srcg.student_id = s_id and cast(srcg.marking_period_id as text) = mp_id and not srcg.gp_scale = 0 group by srcg.student_id, srcg.marking_period_id, short_name"
PL/pgSQL function calc_gpa_mp(integer,character varying) line 34 at SQL statement SQL statement "SELECT calc_gpa_mp(NEW.student_id::int, NEW.marking_period_id::varchar)" PL/pgSQL function t_update_mp_stats() line 16 at PERFORM
Failure Notice
INSERT INTO STUDENT_REPORT_CARD_GRADES (ID,SYEAR,SCHOOL_ID,STUDENT_ID,
COURSE_PERIOD_ID,MARKING_PERIOD_ID,REPORT_CARD_GRADE_ID,GRADE_PERCENT,COMMENT,
GRADE_LETTER,WEIGHTED_GP,UNWEIGHTED_GP,GP_SCALE,COURSE_TITLE,CREDIT_ATTEMPTED,
CREDIT_EARNED,CLASS_RANK,CREDIT_HOURS)
VALUES(nextval('student_report_card_grades_id_seq'),'2020','31','211','124','186','477','88.5',NULL,'B+','3.54',NULL,'4.000','أساليب دفاع','1','1','Y',10.00)
SQL query