select temp1.tempmanagecom,
       (select name
          from laagent
         where '1355739943000' = '1355739943000'
           and agentcode = temp1.tempagentcode),
       temp1.tempbranchattr,
       (select name
          from labranchgroup
         where agentgroup = temp1.tempagentgroup),
       temp1.tempagentcode,
       (select name from laagent where agentcode = temp1.tempagentcode),
       temp1.tempindexcalno,
       temp1.tempcontno,
       (select cvalidate
          from lacommision
         where contno = temp1.tempcontno
           and polno = mainpolno),
       temp1.temptransmoney,
       temp2.temptransmoney
  from (select a.contno as tempcontno,
               sum(a.transmoney) as temptransmoney,
               a.managecom as tempmanagecom,
               a.agentcode as tempagentcode,
               a.branchattr as tempbranchattr,
               b.indexcalno as tempindexcalno,
               a.agentgroup as tempagentgroup
          from lacommision a, lawage b
         where a.agentcode = b.agentcode
           and a.wageno = b.indexcalno
           and a.wageno = '200705'
           and b.agentcode = '0000000280'
           and b.managecom like '86110000'
           and a.branchcode = b.agentgroup
           and a.BranchType = '1'
           and not exists
         (Select 'X'
                  from LACommision b
                 where b.ContNo = a.ContNo
                   and b.polno = a.polno
                   and b.paycount = '1'
                   and b.transtype in ('XT', 'CT')
                   and exists (select 'X'
                          from lpedoritem c
                         where a.contno = c.contno
                           and c.standbyflag1 = '1'))
           and not exists
         (Select 'X'
                  from LACommision b
                 where a.PolNo = b.PolNo
                   and b.F2 is not null
                   and b.F2 = '1')
           and (select b.payintv
                  from lcpol b
                 where b.contno = a.contno
                   and b.mainpolno = b.polno) <> 0
           and a.payintv not in ('1', '-1')
           and ((transtype = 'ZC' and a.paycount = 1 and
               a.cvalidate between
               ADD_MONTHS(to_date('20070501', 'yyyymmdd'), -25) and
               ADD_MONTHS(to_date('20070531', 'yyyymmdd'), -14)) or
               (transtype = 'AA' and exists
                (select *
                    from lccont b
                   where a.contno = b.contno
                     and b.cvalidate between
                         ADD_MONTHS(to_date('20070501', 'yyyymmdd'), -25) and
                         ADD_MONTHS(to_date('20070531', 'yyyymmdd'), -14)) and
                GX_F_HesitationFlag(a.transtype, a.contno, a.receiptno) = 'Y') or
               (transtype = 'PT' and exists
                (select *
                    from lccont b
                   where a.contno = b.contno
                     and b.cvalidate between
                         ADD_MONTHS(to_date('20070501', 'yyyymmdd'), -25) and
                         ADD_MONTHS(to_date('20070531', 'yyyymmdd'), -14)) and
                exists (select *
                           from lpedoritem d
                          where a.contno = d.contno
                            and d.edortype = 'PT'
                            and d.standbyflag1 = '1'
                            and d.edorstate = '0')))
           and (a.PolType = '0' and
               (select count(distinct agentcode)
                   from lacommision b
                  where a.contno = b.contno) = 1)
           and a.F4 <> '1'
           and not exists (select 'X'
                  from lpedoritem c
                 where c.contno = a.contno
                   and edortype = 'PR')
           and not exists (select 'X'
                  from lcprem c
                 where c.contno = a.contno
                   and c.polno = a.polno
                   and freeflag = '1')
           and not exists
         (Select 'X'
                  from LACommision b
                 where a.CommisionSN = b.CommisionSN
                   and b.DutyCode in
                       (Select Code from LDCode where CodeType = 'xs_dutycode'))
         group by a.contno,
                  a.managecom,
                  a.agentcode,
                  a.branchattr,
                  b.indexcalno,
                  a.agentgroup) temp1,
       (select a.contno as tempcontno,
               sum(a.transmoney) as temptransmoney,
               a.managecom as tempmanagecom,
               a.agentcode as tempagentcode,
               a.branchattr as tempbranchattr,
               b.indexcalno as tempindexcalno,
               a.agentgroup as tempagentgroup
          from lacommision a, lawage b
         where a.agentcode = b.agentcode
           and a.wageno = b.indexcalno
           and a.wageno = '200705'
           and b.agentcode = '0000000280'
           and b.managecom like '86110000'
           and a.branchcode = b.agentgroup
           and a.BranchType = '1'
           and ADD_MONTHS(to_date('20070501', 'yyyymmdd'), -25) <=
               (select b.cvalidate
                  from lcpol b
                 where b.contno = a.contno
                   and b.mainpolno = b.polno)
           and (select b.cvalidate
                  from lcpol b
                 where b.contno = a.contno
                   and b.mainpolno = b.polno) <=
               ADD_MONTHS(to_date('20070531', 'yyyymmdd'), -14)
           and not exists (Select 'X'
                  from LACommision b
                 where a.PolNo = b.PolNo
                   and b.F2 is not null
                   and b.F2 = '1')
           and (select b.payintv
                  from lcpol b
                 where b.contno = a.contno
                   and b.mainpolno = b.polno) <> 0
           and transstate in ('03', '04')
           and a.paycount =
               2and(a.PolType = '0'
                and (select count(distinct agentcode)
                       from lacommision b
                      where a.contno = b.contno) = 1)
           and a.F4 <> '1'
           and not exists (select 'X'
                  from lpedoritem c
                 where c.contno = a.contno
                   and edortype = 'PR')
           and not exists (select 'X'
                  from lcprem c
                 where c.contno = a.contno
                   and c.polno = a.polno
                   and freeflag = '1')
           and not exists
         (Select 'X'
                  from LACommision b
                 where a.CommisionSN = b.CommisionSN
                   and b.DutyCode in
                       (Select Code from LDCode where CodeType = 'xs_dutycode'))
         group by a.contno,
                  a.managecom,
                  a.agentcode,
                  a.branchattr,
                  b.indexcalno,
                  a.agentgroup) temp2
 where temp1.tempcontno = temp2.tempcontno;
为什么会报错 ora-00911??哪位大神帮忙看下 谢谢了 实在是找不出来了!