Oracle-错误:'ORA-01400:无法将NULL插入 [英] Oracle - Error: 'ORA-01400: cannot insert NULL into

查看:1514
本文介绍了Oracle-错误:'ORA-01400:无法将NULL插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将记录插入表中,但出现错误-

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

'ORA-01400:无法将NULL插入(....'.表结构为:

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

我从Mysql迁移到Oracle.

I migrate from Mysql to Oracle.

在Mysql上可以使用,但是在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

推荐答案

尝试一下:

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;

这篇关于Oracle-错误:'ORA-01400:无法将NULL插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆