【发布时间】:2020-05-04 11:48:36
【问题描述】:
我有以下表格:
tb_profile tb_mbx tb_profile_mbx tb_profile_cd
id id id_profile id_perfil
cod_mat mbx id_mbx id_cd (matches id_mbx)
concil bp
masc
我需要在验证 id_cd 1,2,4,5 时创建一个查询 和 6 存在于 tb_profile_cd 中,在 带有 tb_profile 的 cod_matrix 参数的 tb_profile_mbx 表 表。
记住每个 concil 在 tb_mbx 表中都有自己的 ID 和一个 concil 有很多 cod_mat。
还有一点是concil id_mbx代表了 tb_profile_cd 表。
还有一点是,正如我上面所说,一个 concil 有很多 鳕鱼垫。每个 concil 大约有 2 万条记录。
根据我的需要,尝试查阅下面的查询,但Oracle返回错误:
insert into tb_profile_mbx values (seq_profile_mbx.nextval,
(select id from tb_profile where concil like '%NEXXERA%')
,(select id from tb_mbx where mbx like '%NEXXERA%')
,null
,null);
ORA-01427: 单行子查询返回多于一行
是否有另一种方法来执行此查询?
提前致谢!
【问题讨论】:
-
insert into tb_profile_mbx select seq_profile_mbx.nextval, id, ... from tb_profile ... -
请提供样本数据和期望的结果。
标签: sql oracle sql-insert