Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Error while trying to INSERT RECORD -ORA-1400

Error while trying to INSERT RECORD -ORA-1400

From: Cecil D'Souza <cecil_at_total.net>
Date: 1997/06/16
Message-ID: <01bc7a2c$365c4e60$7f9dcdcd@default>#1/1

hi guys,

Oracle 7.1 Pl/SQL 2.1

I have a PL/SQL block described below in which I defined a cursor and use a for loop to fetch record from the emp table. Every record has an empno which is the primary key NOT NULL. The table has all the records. I then wrote a procedure to add a bonus to each record in the emp table. When I execute the PL/SQL block I get an error  

: ORA-01400      primary key or mandatory (NOT NULL) column is
          missing or NULL during insert 

Could somebody help in pointing out my error or where I am actually wrong in my coding. I'm a newbie.



I have attached the procedure and PL/SQL block below Procedure:
create or replace procedure give_bonus
          (empno_in emp.empno%type, 
           bonus_in number)

is
  v_bonus number(10,2) := 0;

begin     

   v_bonus := v_bonus + bonus_in;
   insert into emp (comm)

     values (v_bonus)
      

end;



PL/SQL Block

declare

 cursor emp_cur is

    select empno, ename

      from emp
      where  deptno = 10
      order by hiredate;

 emp_rec emp_cur%rowtype;

Begin

  for emp_rec in emp_cur
    Loop
      give_bonus(emp_rec.empno, 10000);
    end loop;   

    commit;
end;
/ Received on Mon Jun 16 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US