Oracle - Error: 'ORA-01400: cannot insert NULL into

15.5k views Asked by At

I'm trying to insert a record into a table, but getting the error -

'ORA-01400: cannot insert NULL into (....'. The table structure is:

I migrate from Mysql to Oracle.

On Mysql this works, but on Oracle it is not working. How can I fix this? Do I need write all column insert query or unselect not null option

1

There are 1 answers

0
user3546225 On

Try this:

create or replace trigger EDITIONS_COR
  before insert or update on EDITIONS
  for each row
begin
  if INSERTING then
    select EDITIONS_SEQ.nextval into :new.ID from DUAL;
  end if;
  :new.CORDATE:=SYSDATE;
  :new.USERNAME:=USER;
end;