kittu
kittu

Reputation: 7008

How do I fix ORA-01427: single-row subquery returns more than one row

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

Answers (1)

jarlh
jarlh

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

Related Questions