5 Replies Latest reply on Mar 7, 2017 6:50 AM by Gary Graham-Oracle

    "single-row subquery returns more than one row" in SQL Developer Query Result

    2951778

      I am running a complex SQL statement with individual fields and few complex CASE statements that sum up few values to come up with a score. When I try to export the output of this SQL, I am running into following error message:

       

      ORA-01427: single-row subquery returns more than one row

      01427. 00000 -  "single-row subquery returns more than one row"

       

      I understand that this is something that comes up in SUBQuery scenario that retunrs > 1 value but I am uanble to understand why this happens when exporting the data.

       

      Here is the sample SQL statement:

       

      SELECT col1, col2..coln,

      (CASE WHEN A = 'aaa' then 1 else 0 end+

      CASE WHEN B = 'bbb' then 1 else 0 end+

      CASE WHEN C = 'ccc' then 1 else 0 end) case_score

      from tbl1, tbl2...tbln

      <join cond>