Create an exception when inserting more values

Viewed 12

articulo is my table:

SQL> describe articulo;

 CODIGO - NUMBER(5)//
 NOMBRE - VARCHAR2(20)//
 PRECIO - NUMBER(7,2)//
 STOCK - NUMBER(3)//
 MARCA - VARCHAR2(20)//
 MODELO - VARCHAR2(20)

I am inserting seven value on purpose which is not possible to insert because my table only has 6, I want to handle this error with an exception but is not working

create or replace procedure procedure_exep as
begin

insert into articulo values(11, 'mayonesa', 4.50, 50, 'Alacena', 'KDJF', 'Amarillo');

exception

when others then 

dbms_output.put_line('Los valores ingresados son mayores a los campos de la tabla');

end;
0 Answers
Related