1

当我ORA-01427: single-row subquery returns more than one row转向运行以下查询时出现错误,知道如何解决这个问题吗?或者你认为我可能需要写一个游标来克服这个问题?请帮忙!

SLECT DISTINCT J.NAME
 FROM Q_jobs j, xx_po x
WHERE j.name IN
                CASE
                   WHEN x.name IS NOT NULL THEN
                      (select name from xx_po)                  
                ELSE
                      (SELECT DISTINCT j.name
                         FROM per_jobs
                        WHERE j.name not LIKE '%Des%')
                END
ORDER BY J.NAME
4

1 回答 1

1

尝试这个 )

SELECT DISTINCT J.NAME
 FROM Q_jobs j, xx_po x
WHERE (x.name IS NOT NULL and j.name IN (select name from xx_po)) 
    or (x.name IS NULL and j.name IN (
                         SELECT DISTINCT j.name
                         FROM per_jobs
                         WHERE j.name not LIKE '%Des%'))
ORDER BY J.NAME
于 2013-03-07T21:11:30.357 回答