Reputation: 7008
This query:
SELECT u2.MR_ID from up_module_master u2 where u2.MR_NAME='Applications'
returns two rows but when i created it I created only one row.
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')
How do I fix ORA-01427: single-row subquery returns more than one row
Upvotes: 0
Views: 939
Reputation: 44766
Do INSERT...SELECT
instead of 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'
Upvotes: 4