日期:2014-05-17  浏览次数:21412 次

oracle ORA-01427:单行子查询返回多个行
select * from (select a.*,rownum row_num from (select a.directflag,(select sheettypename from 
sheettype where id=(select sheettypeid from moduletype where moduleid=trim(a.sheetidruleid))) 
sheettypename,(select code||'-'||abbrev from channel where channelid=a.outcomecustomer)
outcustomer,(select code||'-'||abbrev from channel where channelid=a.incomecustomer) 
incustomer,(select balancetype from balancetypeset where id=a.balancetypeid)
 balancetype,(select goodsno||'-'||goodsname from goods where goodsid=a.goodsid) 
 goodsnanme,a.quantity,a.price,a.amount,a.accdate from channelaccount a where 1=1 
 and a.incomecustomer='acd488efdcc8f4a0ae2e42ebbe8e2f72') a) where row_num>0 and row_num<=20

执行报ORA-01427:单行子查询返回多个行
求高人指点
------解决方案--------------------
把=改为in试试
------解决方案--------------------
SELECT *
  FROM (SELECT A.*, ROWNUM ROW_NUM
          FROM (SELECT A.DIRECTFLAG,
                       (SELECT SHEETTYPENAME
                          FROM SHEETTYPE
                         WHERE ID =
                               (SELECT SHEETTYPEID
                                  FROM MODULETYPE
                                 WHERE MODULEID = TRIM(A.SHEETIDRULEID))) SHEETTYPENAME,
                       (SELECT CODE 
------解决方案--------------------
 '-' 
------解决方案--------------------
 ABBREV
                          FROM CHANNEL
                         WHERE CHANNELID = A.OUTCOMECUSTOMER) OUTCUSTOMER,
                       (SELECT CODE 
------解决方案--------------------
 '-' 
------解决方案--------------------
 ABBREV
                          FROM CHANNEL
     &