问题
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:
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;
来源:https://stackoverflow.com/questions/15247335/oracle-error-ora-01400-cannot-insert-null-into