【发布时间】:2017-11-05 04:43:37
【问题描述】:
插入表 1 (id,table2id)
values
(
1,
(select distinct id from TABLE2 s table2 where table2.data='ABC')
);
假设 TABLE1 的 table2id 列不可为空。但是,(select distinct id from TABLE2 s table2 where table2.data='ABC') 查询可能会返回 null。当 (select distinct id from TABLE2 s table2 where table2.data='ABC') 查询未返回 null 且未收到“table2id 不能为 null”错误消息时,如何将上述查询插入 TABLE1。
【问题讨论】: