Hope you're doing well I'm new to PL/SQL and I'm trying to write a dynamic PL/SQL. What I've written so far is :
declare sql_stmt varchar2(100); v_student_id number := 1; v_new_stname varchar2(50); begin sql_stmt := 'update student set student_name = ''pantea'' where student_id :1 ' || 'returning student_name into :2'; execute immediate sql_stmt using v_student_id returning into v_new_stname; dbms_output.put_line('New student name is :' || v_new_stname); end;
when I want to run the code I see this error :
ORA-06502:Numeric or value error:Character string buffer too small.
I'm 80 percent sure that the problem might be in this part of the code
set student_name = ''pantea''
but I don't know how to solve it and I could not also find it on oracle books I know how to handle this in T/SQL but have no idea how to handle this in PL/SQL.