insert into BT_ACCT_TYPE_T
    (bill_cycle,
     serv_id,
     acct_id,
     phone_id,
     product,
     fee_type1_id,
     fee_type2_id,
     month_total_fee,
     month_primal_fee,
     month_discount_fee,
     month_derated_fee,
     month_adjusted_fee)
    select ' 201301 ',
           a.serv_id,
           '''',
           a.phone_id,
           a.product,
           b.fee_type1_id,
           b.fee_type2_id,
           nvl(SUM(a.charge),''0'') month_total_fee,
           nvl(sum(a.primal_charge),''0'') month_primal_fee,
           nvl(sum(a.discount_charge),''0'') month_discount_fee,
           nvl(sum(a.derated_charge),''0'') month_derated_fee,
           nvl(sum(a.adjusted_charge),''0'') month_adjusted_fee
      from bt_evt_bill_'01
          ' a, BT_FEE_TYPE b
     where a.fee_item_id = b.fee_item_id
      and a.phone_id like ''1%''
     group by a.serv_id,
              a.phone_id,
              a.product,
              b.fee_type1_id,
              b.fee_type2_id ';

解决方案 »

  1.   

    格式错误吧?
    insert into BT_ACCT_TYPE_T
        (bill_cycle,
         serv_id,
         acct_id,
         phone_id,
         product,
         fee_type1_id,
         fee_type2_id,
         month_total_fee,
         month_primal_fee,
         month_discount_fee,
         month_derated_fee,
         month_adjusted_fee)
        select '201301',
               a.serv_id,
               ' ',
               a.phone_id,
               a.product,
               b.fee_type1_id,
               b.fee_type2_id,
               nvl(SUM(a.charge),'0') month_total_fee,
               nvl(sum(a.primal_charge),'0') month_primal_fee,
               nvl(sum(a.discount_charge),'0') month_discount_fee,
               nvl(sum(a.derated_charge),'0') month_derated_fee,
               nvl(sum(a.adjusted_charge),'0') month_adjusted_fee
          from bt_evt_bill_01  a, BT_FEE_TYPE b
         where a.fee_item_id = b.fee_item_id
          and a.phone_id like '1%'
         group by a.serv_id,
                  a.phone_id,
                  a.product,
                  b.fee_type1_id,
                  b.fee_type2_id ;
      

  2.   

    from bt_evt_bill_'01
              ' a, BT_FEE_TYPE b
         where a.fee_item_id = b.fee_item_id
          and a.phone_id like ''1%''
         group by a.serv_id,
                  a.phone_id,
                  a.product,
                  b.fee_type1_id,
                  b.fee_type2_id ';怎么表名中都出现引号了,你的SQL引号太乱了吧