我想在tableB中插入缺少表A的行 当我在oracle上编写下面的代码时,会抛出错误" ORA-00913:值太多了 00913. 00000 - "太多的价值观"
请建议我正确的语法:
insert into tableB
Select * from
(Select *
from tableA A
left join tableB B
on a.id = B.id
and a.year = b.year
where (a.id is null or a.year is null) )A;
答案 0 :(得分:1)
ISNULL条件需要在tableB的列上,您只需要选择tableA列值。
insert into tableB
Select * from
(Select A.*
from tableA A
left join tableB B
on a.id = B.id
and a.year = b.year
where (b.id is null or b.year is null) )A;