PL/SQL Value_error

The value_error exception is an predefined exception of PL/SQL language and catch numeric or value error.




Value_error example

declare
	v_dsp number;	
begin
	select description 
	into v_dsp 
	from course 
	where name='SQL 2';
	dbms_output.put_line('Description is: '||v_dsp);
exception
	when value_error then
		dbms_output.put_line('VALUE_ERROR: '||sqlerrm);
		dbms_output.put_line('Change data type of v_dsp in varchar2(2000)');
end;

Output:

VALUE_ERROR: ORA-06502: PL/SQL: numeric or value error: character to number conversion error

Change data type of v_dsp in varchar2(2000)