简体   繁体   English

Oracle-错误:'ORA-01400:无法将NULL插入

[英]Oracle - Error: 'ORA-01400: cannot insert NULL into

I'm trying to insert a record into a table, but getting the error - 我正在尝试将记录插入表中,但出现错误-

'ORA-01400: cannot insert NULL into (....'. The table structure is: 'ORA-01400:无法将NULL插入(....)。表结构为:

I migrate from Mysql to Oracle. 我从Mysql迁移到Oracle。

On Mysql this works, but on Oracle it is not working. 在Mysql上可以,但是在Oracle上则不能。 How can I fix this? 我怎样才能解决这个问题? Do I need write all column insert query or unselect not null option 我是否需要编写所有列插入查询或取消选择非空选项

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM