Home > Net >  Handling a "too many values" exception in PLSQL
Handling a "too many values" exception in PLSQL

Time:09-08

I need to handle the "too many values" exception in a PLSQL program. The table is:

Table structure of emptest

But I am not able to handle the exception and the program always shows a pre-defined error. Anybody has any ideas?

I tried like this:

enter image description here

Not getting the user defined message.

CodePudding user response:

The issue is that, in your table you have only four columns.

ENO
ENAME
ESAL
DEPTNAME

but you are tying to insert five column values.

insert into emptest values(v_eno, v_ename, v_esal, v_deptname, v_deptno);

Why are you inserting v_deptno when it is not present in the table?

Either alter your table and add one more column or update the code to insert four column value only.

CodePudding user response:

In you table you only have four columns, but you try to insert five column so error is generated error.

v_deptno is not your table

change your query as per following

 Insert Into emptest values(v_eno, v_ename, v_esal, v_deptname);

or add one more column to your table

ALTER TABLE emptest ADD v_deptno Number(4);
  • Related