I am using Oracle 12c, and I generated a table with an identity primary key:
create table t
( x int
generated as identity
primary key,
y varchar2(30)
)
When I run an insert
statement like this:
insert into t (y)
select 'a' from dual
everything looks fine. But when I want to use a union
in the select
statement it gives an error:
insert into t (y)
select 'a' from dual
union
select 'b' from dual
Error report:
SQL Error: ORA-01400: cannot insert NULL into ("REPORT"."T"."X")
01400. 00000 - "cannot insert NULL into (%s)"
*Cause: An attempt was made to insert NULL into previously listed objects.
*Action: These objects cannot accept NULL values.