此查询:
SELECT u2.MR_ID from up_module_master u2 where u2.MR_NAME='Applications'
返回两行,但是当我创建它时,我只创建了一行。
INSERT INTO UP_PERMISSION_MASTER ( MR_ID,P_NAME,P_HOLDER)
values ((SELECT u2.MR_ID from up_module_master u2
where u2.MR_NAME='Applications'),'create','0')
如何修复ORA-01427:单行子查询返回多行
答案 0 :(得分:4)
INSERT...SELECT
代替INSERT VALUES
:
INSERT INTO UP_PERMISSION_MASTER ( MR_ID,P_NAME,P_HOLDER)
SELECT u2.MR_ID, 'create','0'
from up_module_master u2
where u2.MR_NAME='Applications'