简体   繁体   中英

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

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM