Oracle存储过程

     引用自:http://zhouyq.iteye.com/blog/240910

  1. create or replace function func_get_user_by_msisdn(msisdn in number)   
  2. ------------------------------------------------------------------------------   
  3. ---功能描述:通过用户的电话号码,调用局方存储过程 获取用户的基本信息,      ---   
  4. ---          以遍更新card_user_info本地数据表。                            ---   
  5. ---参数:   msisdn in number 代表用户的电话号码(SIM卡)                   ---   
  6. ---时间:2008-09-05                                                        ---   
  7. ---作者:zhouyq                                                            ---   
  8. ---单位:厦门新科技软件股份有限公司                                        ---   
  9. ------------------------------------------------------------------------------   
  10. return pkg_gps_audit.user_record   
  11. is  
  12.   user_record_info pkg_gps_audit.user_record; --用户基本信息类型   
  13.   v_success number := 1;  --成功标志   
  14.     
  15. begin  
  16.   
  17.  --首先获取正常用户的基本信息   
  18.   begin  
  19.        pkg_gps_audit.proc_get_userinfo(msisdn,user_record_info);   
  20.        v_success := 1;   
  21.   exception  when others then  
  22.        v_success := 0;   
  23.   end;   
  24.   
  25.   --其次,如果正常用户获取不到,再查离线用户信息   
  26.   if v_success < 1 then  
  27.   begin  
  28.        pkg_gps_audit.proc_get_cancel_userinfo(msisdn,user_record_info);   
  29.        v_success := 1;   
  30.   exception when others then  
  31.        v_success := 0;   
  32.   end;   
  33.   end if;   
  34.      
  35.      
  36.   if v_success > 0 then    
  37.     return user_record_info;   
  38.   else  
  39.     raise no_data_found;   
  40.   end if;   
  41.   
  42.   
  43. return user_record_info;   
  44. end func_get_user_by_msisdn;   
  45.   
  46.   
  47.   
  48.   
  49.   
  50. create or replace function func_get_user_id(msisdn_bak in number)   
  51. ------------------------------------------------------------------------------   
  52. ---功能描述:通过用户的电话号码获取用户的ID,(有保证数据及时性)            ---   
  53. ---参数:   msisdn in number 代表用户的电话号码(SIM卡)                   ---   
  54. ---时间:2008-09-05                                                        ---   
  55. ---作者:zhouyq                                                            ---   
  56. ---单位:厦门新科技软件股份有限公司                                        ---   
  57. ------------------------------------------------------------------------------   
  58. return number   
  59. is  
  60. user_info pkg_gps_audit.user_record; --用户基本信息   
  61.   
  62. card_info card_user_info%rowtype; --用户基本信息表结构    
  63. type base_cursor is ref cursor;   
  64. cr base_cursor;   
  65.   
  66. user_id number(15); --用户ID;   
  67. begin  
  68.   begin  
  69.     --如果本地card_user_info表可以找到数据,先在本地查找。   
  70.     open cr for select * from card_user_info where msisdn = msisdn_bak;   
  71.     fetch cr into card_info;   
  72.     if cr%found then  
  73.          
  74.       user_id := card_info.user_id;   
  75.     else  
  76.       --获取用户基本信息   
  77.       user_info := func_get_user_by_msisdn(msisdn_bak);   
  78.          
  79.       user_id := user_info.user_id;   
  80.     end if;   
  81.        
  82.     close cr;   
  83.        
  84.     --返回用户ID   
  85.      return user_id;   
  86.   exception    
  87.     when others then     
  88.     raise no_data_found;  --抛出异常   
  89.   end;    
  90.   
  91.   
  92.   
  93. end;   
  94.   
  95.   
  96.   
  97.   
  98.   
  99. create or replace function func_is_first_day   
  100. ------------------------------------------------------------------------------   
  101. ---功能描述:判断今天是否是该月的第一天(1号)                             ---   
  102. ---返回参数:1代表是,0代表不是                                            ---   
  103. ---时间:2008-09-05                                                        ---   
  104. ---作者:zhouyq                                                            ---   
  105. ---单位:厦门新科技软件股份有限公司                                        ---   
  106. ------------------------------------------------------------------------------   
  107. return number    
  108. is  
  109.   v_result number := 0;   
  110.      
  111.   v_day varchar2(2);   
  112. begin  
  113.   select to_char(sysdate,'dd'into v_day from dual;   
  114.   if v_day = '01' then  
  115.     v_result := 1;   
  116.   else    
  117.     v_result := 0;   
  118.   end if;   
  119.      
  120.   return(v_result);   
  121. end func_is_first_day;   
  122.   
  123.   
  124.   
  125.   
  126.   
  127. create or replace procedure proc_delete_day_fee_info   
  128. ------------------------------------------------------------------------------   
  129. ---功能描述: 只保留一个月得数据(8月的日账单10月份删除)                  ---   
  130. ---时间:2008-09-08                                                        ---   
  131. ---作者:zhouyq                                                            ---   
  132. ---单位:厦门新科技软件股份有限公司                                        ---   
  133. ------------------------------------------------------------------------------   
  134. is  
  135.   
  136. type base_cursor is ref cursor;   
  137. cf base_cursor;   
  138. v_fee_id number(18);   
  139. begin  
  140.   begin  
  141.     open cf for  select a.fee_id from user_fee_info a ,day_fee_info b where a.fee_id = b.fee_id and to_char(b.start_time,'yyyy-mm') = to_char(add_months(sysdate,0),'yyyy-mm');   
  142.     fetch cf into v_fee_id;   
  143.     while cf%found loop   
  144.       delete from user_fee_info where fee_id = v_fee_id;   
  145.       delete from day_fee_info where fee_id = v_fee_id;   
  146.       commit;   
  147.          
  148.       fetch cf into v_fee_id;   
  149.     end loop;   
  150.        
  151.     close cf;   
  152.        
  153.   exception when others then  
  154.     rollback;   
  155.     return;   
  156.   end;     
  157.   
  158.   
  159.      
  160. end proc_delete_day_fee_info;   
  161.   
  162.   
  163.   
  164.   
  165. create or replace procedure proc_delete_month_fee_info   
  166. ------------------------------------------------------------------------------   
  167. ---功能描述: 只保留6个月得数据(8月的日账单1月份删除)                  ---   
  168. ---时间:2008-09-08                                                        ---   
  169. ---作者:zhouyq                                                            ---   
  170. ---单位:厦门新科技软件股份有限公司                                        ---   
  171. ------------------------------------------------------------------------------   
  172. is  
  173.   
  174. type base_cursor is ref cursor;   
  175. cf base_cursor;   
  176. v_fee_id number(18);   
  177. begin  
  178.   begin  
  179.     open cf for  select a.fee_id from user_fee_info a ,month_fee_info b where a.fee_id = b.fee_id and to_char(b.start_time,'yyyy-mm') = to_char(add_months(sysdate,0),'yyyy-mm');   
  180.     fetch cf into v_fee_id;   
  181.     while cf%found loop   
  182.       delete from user_fee_info where fee_id = v_fee_id;   
  183.       delete from month_fee_info where fee_id = v_fee_id;   
  184.       commit;   
  185.          
  186.       fetch cf into v_fee_id;   
  187.     end loop;   
  188.        
  189.     close cf;   
  190.        
  191.   exception when others then  
  192.     rollback;   
  193.     return;   
  194.   end;     
  195.   
  196.   
  197.      
  198. end proc_delete_month_fee_info;   
  199.   
  200.   
  201.   
  202. create or replace procedure proc_down_card_user_info   
  203. ------------------------------------------------------------------------------   
  204. ---功能描述:(重要)通过查询本地的group_sims表,获取sim号码集合。           ---   
  205. ---          该表里面的sim字段有两种类型,1种是真实的sim号码,另外一种是   ---   
  206. ---          虚拟的SIM号码,该虚拟的号码可以对应多哥真实的SIM号码。        ---   
  207. ---          simtype字段代表SIM类型,0代表是虚拟的号码,1代表是真实的号码。 ---   
  208. ---          当sim字段为虚拟号码时,对应的simtype为0,同时groupsim为空     ---   
  209. ---          当sim字段为真实号码时,对应的simtype为1,如果groupsim为空,   ---   
  210. ---          代表该号码没有对应的虚拟号。                                  ---   
  211. ---          groupuserid字段代表号码所对应的本地用户,一个用户可以对应多个 ---   
  212. ---          sim(虚拟的与真实的。)                                         ---   
  213. ---                                                                        ---   
  214. ---          遍历group_sims表,查询sim字段,如果为虚拟号码,就调用         ---   
  215. ---           proc_get_payed_msisdns,获取其绑定的真实号码,然后将该批真实  ---   
  216. ---           号码插入到group_sims,同时更新card_user_info表,如果sim是    ---   
  217. ---          真实号码,则只更新card_user_info表 。                         ---   
  218. ---时间:2008-09-05                                                        ---   
  219. ---作者:zhouyq                                                            ---   
  220. ---单位:厦门新科技软件股份有限公司                                        ---   
  221. ------------------------------------------------------------------------------   
  222. is  
  223.   
  224. group_sims_info group_sims%rowtype;--定义group_sims表类型   
  225.   
  226. type type_group_sims_ref is ref cursor--定义group_sims表游标类型   
  227. group_sims_ref type_group_sims_ref;   
  228.   
  229. user_record_info pkg_gps_audit.user_record; --定义用户基本类型   
  230.   
  231. msisdn_table_temp pkg_gps_audit.msisdn_table; --用户SIM号码集合   
  232. msisdn_len number(10) := 0; --用户SIM号码集合长度   
  233.   
  234. v_success number(1) := 1; --成功标志   
  235.   
  236. begin  
  237.   begin  
  238.     --打开group_sims游标   
  239.     open group_sims_ref for select * from group_sims where (groupsim is  null or length(ltrim(groupsim)) = 0);   
  240.     fetch group_sims_ref into group_sims_info;   
  241.   
  242.     --开始遍历该游标   
  243.     while group_sims_ref%found loop   
  244.       --首先判断是否是虚拟号码,   
  245.       if group_sims_info.simtype = 0 then  
  246.         --首先通过虚拟号码,获取对应的SIM号码;   
  247.         begin  
  248.           pkg_gps_audit.proc_get_payed_msisdns(group_sims_info.sim,msisdn_table_temp,msisdn_len);   
  249.              
  250.           if msisdn_len > 0 then  
  251.             for iLen in 1 .. msisdn_len loop   
  252.               --首先更新原来group_sims表中同一个虚拟卡所对应的sim卡(先删后插)   
  253.               delete from group_sims t where t.simtype = 1 and to_number(t.groupsim) = group_sims_info.sim and t.groupuserid = group_sims_info.groupuserid;   
  254.                   
  255.                  
  256.               for xLen in 1..msisdn_len loop   
  257.                 begin  
  258.                   -----通过msisdn获取用户基本信息   
  259.                   user_record_info := func_get_user_by_msisdn(msisdn_table_temp(xLen));   
  260.                 exception when others then  
  261.                   dbms_output.put_line('通过msisdn获取用户基本信息出现了异常!');    
  262.                   v_success := 0;   
  263.                 end;   
  264.                  
  265.                    
  266.                 if v_success > 0 then  
  267.                    insert into group_sims(id,sim,groupsim,groupuserid,simtype,updatetime)values(   
  268.                    SEQ_GROUP_SIMS.Nextval,to_char(msisdn_table_temp(xLen)),group_sims_info.sim,group_sims_info.groupuserid,   
  269.                   1,sysdate);   
  270.                      
  271.                   --更新原来在card_user_info里面的数据(先删除已经存在的再插入新的数据)   
  272.                   delete from card_user_info where msisdn =  msisdn_table_temp(xLen);   
  273.                   
  274.                   insert into card_user_info(user_id,msisdn,brand_name,deal_name,service_status,stop_time,status)   
  275.                   values(user_record_info.user_id,user_record_info.msisdn,user_record_info.brand_name,user_record_info.deal_name   
  276.                   ,user_record_info.service_status,user_record_info.stop_time,1);   
  277.                 end if;   
  278.                     
  279.                 --提交数据   
  280.                 commit;   
  281.               end loop;   
  282.                   
  283.             end loop;   
  284.                 
  285.           end if;   
  286.              
  287.              
  288.           --没有与该虚拟卡对应的SIM号码   
  289.           if msisdn_len <= 0 then     
  290.             --首先更新原来group_sims表中同一个虚拟卡所对应的sim卡(先删后插)   
  291.               delete from group_sims t where t.simtype = 1 and to_number(t.groupsim) = group_sims_info.sim and t.groupuserid = group_sims_info.groupuserid;   
  292.               commit;   
  293.           end if;   
  294.              
  295.         exception when others then  
  296.           --回滚数据   
  297.           rollback;   
  298.           dbms_output.put_line('首先通过虚拟号码,获取对应的SIM号码出现了异常!');   
  299.         end;   
  300.       end if;     
  301.             
  302.       --如果是真实号码,并且没有附属虚拟号码,则直接更新card_user_info表     
  303.       if group_sims_info.simtype > 0 and  (group_sims_info.groupsim is null or length(group_sims_info.groupsim) = 0 ) then  
  304.         begin  
  305.           user_record_info := func_get_user_by_msisdn(group_sims_info.sim);   
  306.              
  307.            --更新原来在card_user_info里面的数据(先删除已经存在的再插入新的数据)   
  308.           delete from card_user_info where msisdn =  group_sims_info.sim ;   
  309.           insert into card_user_info(user_id,msisdn,brand_name,deal_name,service_status,stop_time,status)   
  310.           values(user_record_info.user_id,user_record_info.msisdn,user_record_info.brand_name,user_record_info.deal_name   
  311.           ,user_record_info.service_status,user_record_info.stop_time,1);   
  312.              
  313.           --提交数据   
  314.           commit;   
  315.          
  316.         exception when others then  
  317.            --回滚数据   
  318.           rollback;   
  319.           dbms_output.put_line('更新card_user_info表出现了异常');   
  320.         end;   
  321.            
  322.            
  323.       end if;   
  324.   
  325.   
  326.       --遍历游标   
  327.       fetch group_sims_ref into group_sims_info;   
  328.     end loop;   
  329.        
  330.     --关闭游标   
  331.     close group_sims_ref;   
  332.   
  333.   
  334.   
  335.   exception   
  336.     when others then  
  337.     return;   
  338.   end;   
  339.   
  340.   
  341.   
  342. end proc_down_card_user_info;   
  343.   
  344.   
  345.   
  346. create or replace procedure proc_down_change_card   
  347.   
  348. ------------------------------------------------------------------------------   
  349. ---功能描述:(重要)通过查询本地的group_sims表,获取sim号码集合。           ---   
  350. ---          该表里面的sim字段有两种类型,1种是真实的sim号码,另外一种是   ---   
  351. ---          虚拟的SIM号码,该虚拟的号码可以对应多哥真实的SIM号码。        ---   
  352. ---          simtype字段代表SIM类型,0代表是虚拟的号码,1代表是真实的号码。 ---   
  353. ---          当sim字段为虚拟号码时,对应的simtype为0,同时groupsim为空     ---   
  354. ---          当sim字段为真实号码时,对应的simtype为1,如果groupsim为空,   ---   
  355. ---          代表该号码没有对应的虚拟号。                                  ---   
  356. ---          groupuserid字段代表号码所对应的本地用户,一个用户可以对应多个 ---   
  357. ---          sim(虚拟的与真实的。)                                         ---   
  358. ---                                                                        ---   
  359. ---          遍历group_sims表,查询sim字段,如果为虚拟号码,就调用         ---   
  360. ---           proc_get_payed_msisdns,获取其绑定的真实号码,然后再获取换补卡---   
  361. ---           信息以更新change_card表,如果sim是真实号码,                 ---   
  362. ---            则只更新change_card表 。                                    ---   
  363. ---时间:2008-09-05                                                        ---   
  364. ---作者:zhouyq                                                            ---   
  365. ---单位:厦门新科技软件股份有限公司                                        ---   
  366. ------------------------------------------------------------------------------   
  367.   
  368. is  
  369.   
  370. group_sims_info group_sims%rowtype;--定义group_sims表类型   
  371.   
  372. type type_group_sims_ref is ref cursor--定义group_sims表游标类型   
  373. group_sims_ref type_group_sims_ref;   
  374.   
  375.     
  376.   
  377. simcard_table_temp pkg_gps_audit.simcard_table; --用户换补卡信息集合   
  378. simcard_len number(10) := 0; --用户换补卡信息集合长度   
  379.   
  380. msisdn_table_temp pkg_gps_audit.msisdn_table; --用户SIM号码集合   
  381. msisdn_len number(10) := 0; --用户SIM号码集合长度   
  382.   
  383. begin  
  384.   begin  
  385.     --打开group_sims游标   
  386.     open group_sims_ref for select * from group_sims where (groupsim is  null or length(ltrim(groupsim)) = 0);   
  387.     fetch group_sims_ref into group_sims_info;   
  388.   
  389.     --开始遍历该游标   
  390.     while group_sims_ref%found loop   
  391.       --首先判断是否是虚拟号码,   
  392.       if group_sims_info.simtype = 0 then  
  393.         --首先通过虚拟号码,获取对应的SIM号码;   
  394.         begin  
  395.           pkg_gps_audit.proc_get_payed_msisdns(group_sims_info.sim,msisdn_table_temp,msisdn_len);   
  396.              
  397.           if msisdn_len > 0 then --有数据   
  398.             for iLen in 1 .. msisdn_len loop   
  399.                begin  
  400.                  --通过用户ID,获取远程的换补卡用户信息集合   
  401.                  pkg_gps_audit.proc_get_simcard_his(func_get_user_id(msisdn_table_temp(iLen)),simcard_table_temp,simcard_len);   
  402.              
  403.                  --更新原来在change_card里面的数据(先删除已经存在的再插入新的数据)   
  404.                  if simcard_len > 0 then  
  405.                    --这个步骤的删除条件 有待确认。??   
  406.                    delete from change_card where msisdn = group_sims_info.sim ;   
  407.                    for ilen in 1 .. simcard_len loop   
  408.                      insert into change_card(user_id,msisdn,accept_time,accept_memo,status) values(   
  409.                      simcard_table_temp(ilen).user_id,simcard_table_temp(ilen).msisdn,simcard_table_temp(ilen).accept_time,   
  410.                      simcard_table_temp(ilen).accept_memo,1);   
  411.                    end loop;   
  412.                  end if;   
  413.                     
  414.                  if simcard_len = 0 then  
  415.                    dbms_output.put_line('通过用户IfffffffffD,获取远程的换补卡用户信息集合,出现了异常!');   
  416.                  end if;    
  417.                     
  418.                  commit;   
  419.                exception when others then  
  420.                  dbms_output.put_line('通过用户ID,获取远程的换补卡用户信息集合,出现了异常!');   
  421.                  rollback;   
  422.                end;   
  423.                  
  424.                   
  425.             end loop;    
  426.           end if;   
  427.              
  428.              
  429.              
  430.         exception when others then  
  431.           --回滚数据   
  432.           rollback;   
  433.           dbms_output.put_line('首先通过虚拟号码,获取对应的SIM号码出现了异常!');   
  434.         end;   
  435.       end if;     
  436.             
  437.   
  438.       if  group_sims_info.simtype > 0 and  (group_sims_info.groupsim is null or length(group_sims_info.groupsim) = 0 ) then --如果是真实号码,并且没有附属虚拟号码,则直接更新change_card表   
  439.         begin  
  440.           --通过用户ID,获取远程的换补卡用户信息集合   
  441.           pkg_gps_audit.proc_get_simcard_his(func_get_user_id(group_sims_info.sim),simcard_table_temp,simcard_len);   
  442.              
  443.           --更新原来在change_card里面的数据(先删除已经存在的再插入新的数据)   
  444.           if simcard_len > 0 then  
  445.             --这个步骤的删除条件 有待确认。??   
  446.             delete from change_card where msisdn = group_sims_info.sim ;   
  447.             for ilen in 1 .. simcard_len loop   
  448.               insert into change_card(user_id,msisdn,accept_time,accept_memo,status) values(   
  449.               simcard_table_temp(ilen).user_id,simcard_table_temp(ilen).msisdn,simcard_table_temp(ilen).accept_time,   
  450.               simcard_table_temp(ilen).accept_memo,1);   
  451.             end loop;   
  452.           end if;    
  453.              
  454.              
  455.           --提交数据   
  456.           commit;   
  457.          
  458.         exception when others then  
  459.            --回滚数据   
  460.           rollback;   
  461.            dbms_output.put_line('更新change_card表出现了异常');   
  462.         end;   
  463.            
  464.            
  465.       end if;   
  466.   
  467.   
  468.       --遍历游标   
  469.       fetch group_sims_ref into group_sims_info;   
  470.     end loop;   
  471.        
  472.     --关闭游标   
  473.     close group_sims_ref;   
  474.   
  475.   
  476.   
  477.   exception   
  478.     when others then  
  479.     return;   
  480.   end;   
  481.   
  482.   
  483.   
  484. end proc_down_change_card;   
  485.   
  486.   
  487.   
  488. create or replace procedure proc_down_fee_info   
  489. ------------------------------------------------------------------------------   
  490. ---功能描述:(重要)通过查询本地的group_sims表,获取sim号码集合。           ---   
  491. ---          该表里面的sim字段有两种类型,1种是真实的sim号码,另外一种是   ---   
  492. ---          虚拟的SIM号码,该虚拟的号码可以对应多哥真实的SIM号码。        ---   
  493. ---          simtype字段代表SIM类型,0代表是虚拟的号码,1代表是真实的号码。 ---   
  494. ---          当sim字段为虚拟号码时,对应的simtype为0,同时groupsim为空     ---   
  495. ---          当sim字段为真实号码时,对应的simtype为1,如果groupsim为空,   ---   
  496. ---          代表该号码没有对应的虚拟号。                                  ---   
  497. ---          groupuserid字段代表号码所对应的本地用户,一个用户可以对应多个 ---   
  498. ---          sim(虚拟的与真实的。)                                         ---   
  499. ---                                                                        ---   
  500. ---          遍历group_sims表,查询sim字段,如果为虚拟号码,就调用         ---   
  501. ---           proc_get_payed_msisdns,获取其绑定的真实号码,然后获取每日消费---   
  502. ---           情况,再分别保存到day_fee_Info,month_fee_info两张表,如果    ---   
  503. ---           sim是 真实号码,则只更新day_fee_Info,month_fee_info表 。     ---   
  504. ---时间:2008-09-05                                                        ---   
  505. ---作者:zhouyq                                                            ---   
  506. ---单位:厦门新科技软件股份有限公司                                        ---   
  507. ------------------------------------------------------------------------------   
  508.   
  509. is  
  510.   
  511. group_sims_info group_sims%rowtype;--定义group_sims表类型   
  512.   
  513. type type_group_sims_ref is ref cursor--定义group_sims表游标类型   
  514. group_sims_ref type_group_sims_ref;   
  515.   
  516.   
  517. msisdn_table_temp pkg_gps_audit.msisdn_table; --用户SIM号码集合   
  518. msisdn_len number(10) := 0; --用户SIM号码集合长度   
  519.   
  520. base_fee pkg_gps_audit.fee_record;  --用户每日消费结构信息   
  521.   
  522. is_first_day number(1); --是否是每月一号标志   
  523. user_fee_info_nextval number(15); --user_fee_info表的下一个序列号   
  524.   
  525. user_fee_info_temp pkg_gps_audit.fee_record;  --user_fee_info数据缓存   
  526.   
  527. v_fee_id number(15);--消费ID    
  528.     
  529.   
  530. begin  
  531.   begin  
  532.      
  533.     --打开group_sims游标   
  534.     open group_sims_ref for select * from group_sims where (groupsim is  null or length(ltrim(groupsim)) = 0);   
  535.     fetch group_sims_ref into group_sims_info;   
  536.   
  537.     --开始遍历该游标   
  538.     while group_sims_ref%found loop   
  539.       --首先判断是否是虚拟号码,   
  540.       if group_sims_info.simtype = 0 then  
  541.         --首先通过虚拟号码,获取对应的SIM号码;   
  542.         begin  
  543.           pkg_gps_audit.proc_get_payed_msisdns(group_sims_info.sim,msisdn_table_temp,msisdn_len);   
  544.              
  545.           if msisdn_len > 0 then --有数据   
  546.             for iLen in 1 .. msisdn_len loop   
  547.                  
  548.               --首先获取该用户每日消费记录,如果今天刚好是1号,那么获取到的数据刚好是上个月1-30号的总和   
  549.               --如果不是1号,那么获取到的是本月前几天的总和   
  550.               pkg_gps_audit.proc_get_userfee(func_get_user_id(msisdn_table_temp(iLen)),base_fee);   
  551.               
  552.               --判断当前日期是否是每月1号   
  553.               is_first_day := func_is_first_day();   
  554.               if is_first_day = 1 then  --1号   
  555.                  
  556.                 -----(begin)保存到user_fee_info,day_fee_info表--------------   
  557.                 begin  
  558.                    
  559.                 -----计算出上个月的总和   
  560.                 begin  
  561.                   select  user_id,   
  562.                   sum(fee_base),sum(fee_pkg_month),sum(fee_keep),sum(fee_oth_month),sum(fee_vpn),   
  563.                   sum(fee_shift),sum(fee_local),sum(fee_long),sum(fee_inprov),sum(fee_inprov_long),   
  564.                   sum(fee_outprov),sum(fee_outprov_long),sum(fee_inter),sum(fee_inter_long),   
  565.                   sum(fee_cmnet),sum(fee_trust),sum(fee_ptp_sms),sum(fee_mms),sum(fee_magazine),   
  566.                   sum(fee_gprs),sum(fee_wap),sum(fee_data_month),   
  567.                   sum(fee_data),sum(fee_ring),sum(fee_display),sum(fee_ext),sum(fee_other),   
  568.                   sum(fee_all),sum(fee_for_others),sum(fee_by_others)    
  569.                   into user_fee_info_temp from user_fee_info   
  570.                   where user_id = base_fee.user_id   
  571.                   and fee_id in (select fee_id from day_fee_info where to_char(start_time,'yyyy-mm') = to_char(add_months(sysdate,-1),'yyyy-mm'))  group by user_id ;   
  572.                      
  573.                 exception when others then  
  574.                   user_fee_info_temp.user_id := base_fee.user_id;   
  575.                   user_fee_info_temp.fee_base := 0.00;   
  576.                   user_fee_info_temp.fee_pkg_month := 0.00;   
  577.                   user_fee_info_temp.fee_keep := 0.00;   
  578.                   user_fee_info_temp.fee_oth_month := 0.00;   
  579.                   user_fee_info_temp.fee_vpn := 0.00;   
  580.                   user_fee_info_temp.fee_shift := 0.00;   
  581.                   user_fee_info_temp.fee_local := 0.00;   
  582.                   user_fee_info_temp.fee_long := 0.00;   
  583.                   user_fee_info_temp.fee_inprov := 0.00;   
  584.                   user_fee_info_temp.fee_inprov_long := 0.00;   
  585.                   user_fee_info_temp.fee_outprov := 0.00;   
  586.                   user_fee_info_temp.fee_outprov_long := 0.00;   
  587.                   user_fee_info_temp.fee_inter := 0.00;   
  588.                   user_fee_info_temp.fee_inter_long := 0.00;   
  589.                   user_fee_info_temp.fee_cmnet := 0.00;   
  590.                   user_fee_info_temp.fee_trust := 0.00;   
  591.                   user_fee_info_temp.fee_ptp_sms := 0.00;   
  592.                   user_fee_info_temp.fee_mms := 0.00;   
  593.                   user_fee_info_temp.fee_magazine := 0.00;   
  594.                   user_fee_info_temp.fee_gprs := 0.00;   
  595.                   user_fee_info_temp.fee_wap := 0.00;   
  596.                   user_fee_info_temp.fee_data_month := 0.00;   
  597.                   user_fee_info_temp.fee_data := 0.00;   
  598.                   user_fee_info_temp.fee_ring := 0.00;   
  599.                   user_fee_info_temp.fee_display := 0.00;   
  600.                   user_fee_info_temp.fee_ext := 0.00;   
  601.                   user_fee_info_temp.fee_other := 0.00;   
  602.                   user_fee_info_temp.fee_all := 0.00;   
  603.                   user_fee_info_temp.fee_for_others := 0.00;   
  604.                   user_fee_info_temp.fee_by_others := 0.00;   
  605.                 end;   
  606.                    
  607.                 
  608.                 --保存到user_fee_info,day_fee_info表   
  609.                 select seq_user_fee_info.nextval into user_fee_info_nextval from dual;   
  610.                 insert into user_fee_info(fee_id,user_id,fee_base,fee_pkg_month,fee_keep,fee_oth_month,fee_vpn,   
  611.                 fee_shift,fee_local,fee_long,fee_inprov,fee_inprov_long,fee_outprov,fee_outprov_long,fee_inter,fee_inter_long,   
  612.                 fee_cmnet,fee_trust,fee_ptp_sms,fee_mms,fee_magazine,fee_gprs,fee_wap,fee_data_month,   
  613.                 fee_data,fee_ring,fee_display,fee_ext,fee_other,fee_all,fee_for_others,fee_by_others)   
  614.                 values(   
  615.                 user_fee_info_nextval,base_fee.user_id,   
  616.                 decode(sign(base_fee.fee_base-user_fee_info_temp.fee_base),1,base_fee.fee_base-user_fee_info_temp.fee_base,0.00),   
  617.                 decode(sign(base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month),1,base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month,0.00),   
  618.                 decode(sign(base_fee.fee_keep-user_fee_info_temp.fee_keep),1,base_fee.fee_keep-user_fee_info_temp.fee_keep,0.00),    
  619.                 decode(sign(base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month),1,base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month,0.00),     
  620.                 decode(sign(base_fee.fee_vpn-user_fee_info_temp.fee_vpn),1,base_fee.fee_vpn-user_fee_info_temp.fee_vpn,0.00),      
  621.                 decode(sign(base_fee.fee_shift-user_fee_info_temp.fee_shift),1,base_fee.fee_shift-user_fee_info_temp.fee_shift,0.00),       
  622.                 decode(sign(base_fee.fee_local-user_fee_info_temp.fee_local),1,base_fee.fee_local-user_fee_info_temp.fee_local,0.00),       
  623.                 decode(sign(base_fee.fee_long-user_fee_info_temp.fee_long),1,base_fee.fee_long-user_fee_info_temp.fee_long,0.00),       
  624.                 decode(sign(base_fee.fee_inprov-user_fee_info_temp.fee_inprov),1,base_fee.fee_inprov-user_fee_info_temp.fee_inprov,0.00),       
  625.                 decode(sign(base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long),1,base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long,0.00),       
  626.                 decode(sign(base_fee.fee_outprov-user_fee_info_temp.fee_outprov),1,base_fee.fee_outprov-user_fee_info_temp.fee_outprov,0.00),       
  627.                 decode(sign(base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long),1,base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long,0.00),       
  628.                 decode(sign(base_fee.fee_inter-user_fee_info_temp.fee_inter),1,base_fee.fee_inter-user_fee_info_temp.fee_inter,0.00),       
  629.                 decode(sign(base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long),1,base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long,0.00),        
  630.                 decode(sign(base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet),1,base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet,0.00),         
  631.                 decode(sign(base_fee.fee_trust-user_fee_info_temp.fee_trust),1,base_fee.fee_trust-user_fee_info_temp.fee_trust,0.00),          
  632.                 decode(sign(base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms),1,base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms,0.00),           
  633.                 decode(sign(base_fee.fee_mms-user_fee_info_temp.fee_mms),1,base_fee.fee_mms-user_fee_info_temp.fee_mms,0.00),            
  634.                 decode(sign(base_fee.fee_magazine-user_fee_info_temp.fee_magazine),1,base_fee.fee_magazine-user_fee_info_temp.fee_magazine,0.00),             
  635.                 decode(sign(base_fee.fee_gprs-user_fee_info_temp.fee_gprs),1,base_fee.fee_gprs-user_fee_info_temp.fee_gprs,0.00),             
  636.                 decode(sign(base_fee.fee_wap-user_fee_info_temp.fee_wap),1,base_fee.fee_wap-user_fee_info_temp.fee_wap,0.00),              
  637.                 decode(sign(base_fee.fee_data_month-user_fee_info_temp.fee_data_month),1,base_fee.fee_data_month-user_fee_info_temp.fee_data_month,0.00),               
  638.                 decode(sign(base_fee.fee_data-user_fee_info_temp.fee_data),1,base_fee.fee_data-user_fee_info_temp.fee_data,0.00),                 
  639.                 decode(sign(base_fee.fee_ring-user_fee_info_temp.fee_ring),1,base_fee.fee_ring-user_fee_info_temp.fee_ring,0.00),                  
  640.                 decode(sign(base_fee.fee_display-user_fee_info_temp.fee_display),1,base_fee.fee_display-user_fee_info_temp.fee_display,0.00),                  
  641.                 decode(sign(base_fee.fee_ext-user_fee_info_temp.fee_ext),1,base_fee.fee_ext-user_fee_info_temp.fee_ext,0.00),                  
  642.                 decode(sign(base_fee.fee_other-user_fee_info_temp.fee_other),1,base_fee.fee_other-user_fee_info_temp.fee_other,0.00),                   
  643.                 decode(sign(base_fee.fee_all-user_fee_info_temp.fee_all),1,base_fee.fee_all-user_fee_info_temp.fee_all,0.00),                   
  644.                 decode(sign(base_fee.fee_for_others-user_fee_info_temp.fee_for_others),1,base_fee.fee_for_others-user_fee_info_temp.fee_for_others,0.00),                   
  645.                 decode(sign(base_fee.fee_by_others-user_fee_info_temp.fee_by_others),1,base_fee.fee_by_others-user_fee_info_temp.fee_by_others,0.00) );   
  646.                 
  647.                 insert into day_fee_info(id,fee_id,start_time) values(seq_day_fee_info.nextval,user_fee_info_nextval,sysdate-1);   
  648.                    
  649.                 commit;   
  650.                 exception when others then  
  651.                   rollback;   
  652.                   dbms_output.put_line('保存到user_fee_info,day_fee_info表出现了异常');   
  653.                 end;   
  654.                 -------------(end)保存到user_fee_info,day_fee_info表-------------------------------------   
  655.                 
  656.                 
  657.                 -------------------(begin)保存到user_fee_info,month_fee_info表---------------------------------   
  658.                 begin  
  659.                    
  660.                 begin  
  661.                 ----首先删除再更新原来的user_fee_info,month_fee_info   
  662.                 select a.fee_id  into v_fee_id  from month_fee_info a, user_fee_info b where a.fee_id = b.fee_id and b.user_id = base_fee.user_id   and to_char(a.start_time,'yyyy-mm') = to_char(add_months(sysdate,-1),'yyyy-mm');   
  663.                 delete from user_fee_info x where x.fee_id = v_fee_id;   
  664.                 delete from month_fee_info y where y.fee_id = v_fee_id;    
  665.                 commit;   
  666.                    
  667.                    
  668.                 exception when others then  
  669.                   rollback;   
  670.                 end;   
  671.                 ----插入新的数据   
  672.                 select seq_user_fee_info.nextval into user_fee_info_nextval from dual;   
  673.                 insert into user_fee_info(fee_id,user_id,fee_base,fee_pkg_month,fee_keep,fee_oth_month,fee_vpn,   
  674.                 fee_shift,fee_local,fee_long,fee_inprov,fee_inprov_long,fee_outprov,fee_outprov_long,fee_inter,fee_inter_long,   
  675.                 fee_cmnet,fee_trust,fee_ptp_sms,fee_mms,fee_magazine,fee_gprs,fee_wap,fee_data_month,   
  676.                 fee_data,fee_ring,fee_display,fee_ext,fee_other,fee_all,fee_for_others,fee_by_others)   
  677.                 values( user_fee_info_nextval,base_fee.user_id, base_fee.fee_base, base_fee.fee_pkg_month,   
  678.                 base_fee.fee_keep, base_fee.fee_oth_month, base_fee.fee_vpn,   
  679.                 base_fee.fee_shift, base_fee.fee_local, base_fee.fee_long, base_fee.fee_inprov,   
  680.                 base_fee.fee_inprov_long, base_fee.fee_outprov, base_fee.fee_outprov_long,   
  681.                 base_fee.fee_inter, base_fee.fee_inter_long, base_fee.fee_cmnet,   
  682.                 base_fee.fee_trust, base_fee.fee_ptp_sms,  base_fee.fee_mms,   
  683.                 base_fee.fee_magazine,  base_fee.fee_gprs,  base_fee.fee_wap,   
  684.                 base_fee.fee_data_month,  base_fee.fee_data,  base_fee.fee_ring,   
  685.                 base_fee.fee_display, base_fee.fee_ext,  base_fee.fee_other,   
  686.                 base_fee.fee_all,  base_fee.fee_for_others, base_fee.fee_by_others);   
  687.                
  688.                 insert into month_fee_info(id,fee_id,start_time) values(seq_month_fee_info.nextval,user_fee_info_nextval,sysdate-1);        
  689.                 commit;   
  690.                 exception when others then  
  691.                   rollback;   
  692.                   dbms_output.put_line('保存到user_fee_info,month_fee_info表出现了异常');   
  693.                 end;   
  694.                 ----------------(end)保存到user_fee_info,month_fee_info表--------------------------------------   
  695.                  
  696.               else --不是本月第一天   
  697.                  
  698.                 -------------------(begin)保存到user_fee_info,day_fee_info表-------------------   
  699.                 begin  
  700.                    
  701.                 begin  
  702.                 --计算出本月的总和   
  703.                 select  user_id,   
  704.                 sum(fee_base),sum(fee_pkg_month),sum(fee_keep),sum(fee_oth_month),sum(fee_vpn),   
  705.                 sum(fee_shift),sum(fee_local),sum(fee_long),sum(fee_inprov),sum(fee_inprov_long),   
  706.                 sum(fee_outprov),sum(fee_outprov_long),sum(fee_inter),sum(fee_inter_long),   
  707.                 sum(fee_cmnet),sum(fee_trust),sum(fee_ptp_sms),sum(fee_mms),sum(fee_magazine),   
  708.                 sum(fee_gprs),sum(fee_wap),sum(fee_data_month),   
  709.                 sum(fee_data),sum(fee_ring),sum(fee_display),sum(fee_ext),sum(fee_other),   
  710.                 sum(fee_all),sum(fee_for_others),sum(fee_by_others)    
  711.                 into user_fee_info_temp from user_fee_info   
  712.                 where user_id =  base_fee.user_id   
  713.                 and fee_id in (select fee_id from day_fee_info where to_char(start_time,'yyyy-mm') = to_char(sysdate,'yyyy-mm'))  group by user_id ;   
  714.                    
  715.                 exception when others then  
  716.                   user_fee_info_temp.user_id := base_fee.user_id;   
  717.                   user_fee_info_temp.fee_base := 0.00;   
  718.                   user_fee_info_temp.fee_pkg_month := 0.00;   
  719.                   user_fee_info_temp.fee_keep := 0.00;   
  720.                   user_fee_info_temp.fee_oth_month := 0.00;   
  721.                   user_fee_info_temp.fee_vpn := 0.00;   
  722.                   user_fee_info_temp.fee_shift := 0.00;   
  723.                   user_fee_info_temp.fee_local := 0.00;   
  724.                   user_fee_info_temp.fee_long := 0.00;   
  725.                   user_fee_info_temp.fee_inprov := 0.00;   
  726.                   user_fee_info_temp.fee_inprov_long := 0.00;   
  727.                   user_fee_info_temp.fee_outprov := 0.00;   
  728.                   user_fee_info_temp.fee_outprov_long := 0.00;   
  729.                   user_fee_info_temp.fee_inter := 0.00;   
  730.                   user_fee_info_temp.fee_inter_long := 0.00;   
  731.                   user_fee_info_temp.fee_cmnet := 0.00;   
  732.                   user_fee_info_temp.fee_trust := 0.00;   
  733.                   user_fee_info_temp.fee_ptp_sms := 0.00;   
  734.                   user_fee_info_temp.fee_mms := 0.00;   
  735.                   user_fee_info_temp.fee_magazine := 0.00;   
  736.                   user_fee_info_temp.fee_gprs := 0.00;   
  737.                   user_fee_info_temp.fee_wap := 0.00;   
  738.                   user_fee_info_temp.fee_data_month := 0.00;   
  739.                   user_fee_info_temp.fee_data := 0.00;   
  740.                   user_fee_info_temp.fee_ring := 0.00;   
  741.                   user_fee_info_temp.fee_display := 0.00;   
  742.                   user_fee_info_temp.fee_ext := 0.00;   
  743.                   user_fee_info_temp.fee_other := 0.00;   
  744.                   user_fee_info_temp.fee_all := 0.00;   
  745.                   user_fee_info_temp.fee_for_others := 0.00;   
  746.                   user_fee_info_temp.fee_by_others := 0.00;   
  747.                 end;   
  748.                 
  749.                 --保存到user_fee_info,day_fee_info表   
  750.                 select seq_user_fee_info.nextval into user_fee_info_nextval from dual;   
  751.                 insert into user_fee_info(fee_id,user_id,fee_base,fee_pkg_month,fee_keep,fee_oth_month,fee_vpn,   
  752.                 fee_shift,fee_local,fee_long,fee_inprov,fee_inprov_long,fee_outprov,fee_outprov_long,fee_inter,fee_inter_long,   
  753.                 fee_cmnet,fee_trust,fee_ptp_sms,fee_mms,fee_magazine,fee_gprs,fee_wap,fee_data_month,   
  754.                 fee_data,fee_ring,fee_display,fee_ext,fee_other,fee_all,fee_for_others,fee_by_others)   
  755.                 values(   
  756.                 user_fee_info_nextval,base_fee.user_id,   
  757.                 decode(sign(base_fee.fee_base-user_fee_info_temp.fee_base),1,base_fee.fee_base-user_fee_info_temp.fee_base,0.00),   
  758.                 decode(sign(base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month),1,base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month,0.00),   
  759.                 decode(sign(base_fee.fee_keep-user_fee_info_temp.fee_keep),1,base_fee.fee_keep-user_fee_info_temp.fee_keep,0.00),    
  760.                 decode(sign(base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month),1,base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month,0.00),     
  761.                 decode(sign(base_fee.fee_vpn-user_fee_info_temp.fee_vpn),1,base_fee.fee_vpn-user_fee_info_temp.fee_vpn,0.00),      
  762.                 decode(sign(base_fee.fee_shift-user_fee_info_temp.fee_shift),1,base_fee.fee_shift-user_fee_info_temp.fee_shift,0.00),       
  763.                 decode(sign(base_fee.fee_local-user_fee_info_temp.fee_local),1,base_fee.fee_local-user_fee_info_temp.fee_local,0.00),       
  764.                 decode(sign(base_fee.fee_long-user_fee_info_temp.fee_long),1,base_fee.fee_long-user_fee_info_temp.fee_long,0.00),       
  765.                 decode(sign(base_fee.fee_inprov-user_fee_info_temp.fee_inprov),1,base_fee.fee_inprov-user_fee_info_temp.fee_inprov,0.00),       
  766.                 decode(sign(base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long),1,base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long,0.00),       
  767.                 decode(sign(base_fee.fee_outprov-user_fee_info_temp.fee_outprov),1,base_fee.fee_outprov-user_fee_info_temp.fee_outprov,0.00),       
  768.                 decode(sign(base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long),1,base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long,0.00),       
  769.                 decode(sign(base_fee.fee_inter-user_fee_info_temp.fee_inter),1,base_fee.fee_inter-user_fee_info_temp.fee_inter,0.00),       
  770.                 decode(sign(base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long),1,base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long,0.00),        
  771.                 decode(sign(base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet),1,base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet,0.00),         
  772.                 decode(sign(base_fee.fee_trust-user_fee_info_temp.fee_trust),1,base_fee.fee_trust-user_fee_info_temp.fee_trust,0.00),          
  773.                 decode(sign(base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms),1,base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms,0.00),           
  774.                 decode(sign(base_fee.fee_mms-user_fee_info_temp.fee_mms),1,base_fee.fee_mms-user_fee_info_temp.fee_mms,0.00),            
  775.                 decode(sign(base_fee.fee_magazine-user_fee_info_temp.fee_magazine),1,base_fee.fee_magazine-user_fee_info_temp.fee_magazine,0.00),             
  776.                 decode(sign(base_fee.fee_gprs-user_fee_info_temp.fee_gprs),1,base_fee.fee_gprs-user_fee_info_temp.fee_gprs,0.00),             
  777.                 decode(sign(base_fee.fee_wap-user_fee_info_temp.fee_wap),1,base_fee.fee_wap-user_fee_info_temp.fee_wap,0.00),              
  778.                 decode(sign(base_fee.fee_data_month-user_fee_info_temp.fee_data_month),1,base_fee.fee_data_month-user_fee_info_temp.fee_data_month,0.00),               
  779.                 decode(sign(base_fee.fee_data-user_fee_info_temp.fee_data),1,base_fee.fee_data-user_fee_info_temp.fee_data,0.00),                 
  780.                 decode(sign(base_fee.fee_ring-user_fee_info_temp.fee_ring),1,base_fee.fee_ring-user_fee_info_temp.fee_ring,0.00),                  
  781.                 decode(sign(base_fee.fee_display-user_fee_info_temp.fee_display),1,base_fee.fee_display-user_fee_info_temp.fee_display,0.00),                  
  782.                 decode(sign(base_fee.fee_ext-user_fee_info_temp.fee_ext),1,base_fee.fee_ext-user_fee_info_temp.fee_ext,0.00),                  
  783.                 decode(sign(base_fee.fee_other-user_fee_info_temp.fee_other),1,base_fee.fee_other-user_fee_info_temp.fee_other,0.00),                   
  784.                 decode(sign(base_fee.fee_all-user_fee_info_temp.fee_all),1,base_fee.fee_all-user_fee_info_temp.fee_all,0.00),                   
  785.                 decode(sign(base_fee.fee_for_others-user_fee_info_temp.fee_for_others),1,base_fee.fee_for_others-user_fee_info_temp.fee_for_others,0.00),                   
  786.                 decode(sign(base_fee.fee_by_others-user_fee_info_temp.fee_by_others),1,base_fee.fee_by_others-user_fee_info_temp.fee_by_others,0.00) );   
  787.                 
  788.                 insert into day_fee_info(id,fee_id,start_time) values(seq_day_fee_info.nextval,user_fee_info_nextval,sysdate-1);   
  789.                    
  790.                 commit;   
  791.                 exception when others then  
  792.                   rollback;   
  793.                   dbms_output.put_line('保存到user_fee_info,day_fee_info表出现了异常');   
  794.                 end;   
  795.                 ------------------(end)保存到user_fee_info,day_fee_info表----------------------------------   
  796.                 
  797.                
  798.                 
  799.                 
  800.                   
  801.                 ----------------(begin)保存到user_fee_info,month_fee_info表----------------------   
  802.                 begin  
  803.                    
  804.                 begin  
  805.                 ----首先删除再更新原来的user_fee_info,month_fee_info   
  806.                   
  807.                 select a.fee_id  into v_fee_id  from month_fee_info a, user_fee_info b where a.fee_id = b.fee_id and b.user_id = base_fee.user_id   and to_char(a.start_time,'yyyy-mm') = to_char(sysdate,'yyyy-mm') ;   
  808.                 delete from user_fee_info x where x.fee_id = v_fee_id;   
  809.                 delete from month_fee_info y where y.fee_id = v_fee_id;    
  810.                 commit;   
  811.                 exception when others then  
  812.                   rollback;   
  813.                 end;   
  814.                  
  815.                 
  816.                 ----插入新的数据   
  817.                 select seq_user_fee_info.nextval into user_fee_info_nextval from dual;   
  818.                 insert into user_fee_info(fee_id,user_id,fee_base,fee_pkg_month,fee_keep,fee_oth_month,fee_vpn,   
  819.                 fee_shift,fee_local,fee_long,fee_inprov,fee_inprov_long,fee_outprov,fee_outprov_long,fee_inter,fee_inter_long,   
  820.                 fee_cmnet,fee_trust,fee_ptp_sms,fee_mms,fee_magazine,fee_gprs,fee_wap,fee_data_month,   
  821.                 fee_data,fee_ring,fee_display,fee_ext,fee_other,fee_all,fee_for_others,fee_by_others)   
  822.                 values( user_fee_info_nextval,base_fee.user_id, base_fee.fee_base, base_fee.fee_pkg_month,   
  823.                 base_fee.fee_keep, base_fee.fee_oth_month, base_fee.fee_vpn,   
  824.                 base_fee.fee_shift, base_fee.fee_local, base_fee.fee_long, base_fee.fee_inprov,   
  825.                 base_fee.fee_inprov_long, base_fee.fee_outprov, base_fee.fee_outprov_long,   
  826.                 base_fee.fee_inter, base_fee.fee_inter_long, base_fee.fee_cmnet,   
  827.                 base_fee.fee_trust, base_fee.fee_ptp_sms,  base_fee.fee_mms,   
  828.                 base_fee.fee_magazine,  base_fee.fee_gprs,  base_fee.fee_wap,   
  829.                 base_fee.fee_data_month,  base_fee.fee_data,  base_fee.fee_ring,   
  830.                 base_fee.fee_display, base_fee.fee_ext,  base_fee.fee_other,   
  831.                 base_fee.fee_all,  base_fee.fee_for_others, base_fee.fee_by_others);   
  832.                
  833.                 insert into month_fee_info(id,fee_id,start_time) values(seq_month_fee_info.nextval,user_fee_info_nextval,sysdate);   
  834.                    
  835.                 commit;   
  836.                 exception when others then  
  837.                   rollback;   
  838.                   dbms_output.put_line('保存到user_fee_info,month_fee_info表出现了异常');   
  839.                 end;    
  840.                 ----------------(end)保存到user_fee_info,month_fee_info表----------------------        
  841.   
  842.               end if;   
  843.               
  844.               
  845.                   
  846.                  
  847.                   
  848.             end loop;    
  849.           end if;   
  850.              
  851.              
  852.               
  853.         exception when others then  
  854.           --回滚数据   
  855.           rollback;   
  856.           dbms_output.put_line('首先通过虚拟号码,获取对应的SIM号码出现了异常!');   
  857.         end;   
  858.       end if;     
  859.             
  860.             
  861.       --如果是真实号码,并且没有附属虚拟号码,则直接更新day_fee_info,month_fee_info表   
  862.       if group_sims_info.simtype > 0 and (group_sims_info.groupsim is null or length(group_sims_info.groupsim) = 0 ) then  
  863.         begin  
  864.            --首先获取该用户每日消费记录,如果今天刚好是1号,那么获取到的数据刚好是上个月1-30号的总和   
  865.            --如果不是1号,那么获取到的是本月前几天的总和   
  866.            pkg_gps_audit.proc_get_userfee(func_get_user_id(group_sims_info.sim),base_fee);   
  867.               
  868.            --判断当前日期是否是每月1号   
  869.            is_first_day := func_is_first_day();   
  870.            if is_first_day = 1 then    
  871.              ----------------------(begin)-------------------    
  872.              begin  
  873.                 
  874.              begin  
  875.                --计算出上个月的总和   
  876.                select  user_id,   
  877.                sum(fee_base),sum(fee_pkg_month),sum(fee_keep),sum(fee_oth_month),sum(fee_vpn),   
  878.                sum(fee_shift),sum(fee_local),sum(fee_long),sum(fee_inprov),sum(fee_inprov_long),   
  879.                sum(fee_outprov),sum(fee_outprov_long),sum(fee_inter),sum(fee_inter_long),   
  880.                sum(fee_cmnet),sum(fee_trust),sum(fee_ptp_sms),sum(fee_mms),sum(fee_magazine),   
  881.                sum(fee_gprs),sum(fee_wap),sum(fee_data_month),   
  882.                sum(fee_data),sum(fee_ring),sum(fee_display),sum(fee_ext),sum(fee_other),   
  883.                sum(fee_all),sum(fee_for_others),sum(fee_by_others)    
  884.                into user_fee_info_temp from user_fee_info   
  885.                where user_id = func_get_user_id(group_sims_info.sim)   
  886.                and fee_id in (select fee_id from day_fee_info where to_char(start_time,'yyyy-mm') = to_char(add_months(sysdate,-1),'yyyy-mm'))     
  887.                group by user_id ;   
  888.                 
  889.              exception when others then  
  890.                   user_fee_info_temp.user_id := base_fee.user_id;   
  891.                   user_fee_info_temp.fee_base := 0.00;   
  892.                   user_fee_info_temp.fee_pkg_month := 0.00;   
  893.                   user_fee_info_temp.fee_keep := 0.00;   
  894.                   user_fee_info_temp.fee_oth_month := 0.00;   
  895.                   user_fee_info_temp.fee_vpn := 0.00;   
  896.                   user_fee_info_temp.fee_shift := 0.00;   
  897.                   user_fee_info_temp.fee_local := 0.00;   
  898.                   user_fee_info_temp.fee_long := 0.00;   
  899.                   user_fee_info_temp.fee_inprov := 0.00;   
  900.                   user_fee_info_temp.fee_inprov_long := 0.00;   
  901.                   user_fee_info_temp.fee_outprov := 0.00;   
  902.                   user_fee_info_temp.fee_outprov_long := 0.00;   
  903.                   user_fee_info_temp.fee_inter := 0.00;   
  904.                   user_fee_info_temp.fee_inter_long := 0.00;   
  905.                   user_fee_info_temp.fee_cmnet := 0.00;   
  906.                   user_fee_info_temp.fee_trust := 0.00;   
  907.                   user_fee_info_temp.fee_ptp_sms := 0.00;   
  908.                   user_fee_info_temp.fee_mms := 0.00;   
  909.                   user_fee_info_temp.fee_magazine := 0.00;   
  910.                   user_fee_info_temp.fee_gprs := 0.00;   
  911.                   user_fee_info_temp.fee_wap := 0.00;   
  912.                   user_fee_info_temp.fee_data_month := 0.00;   
  913.                   user_fee_info_temp.fee_data := 0.00;   
  914.                   user_fee_info_temp.fee_ring := 0.00;   
  915.                   user_fee_info_temp.fee_display := 0.00;   
  916.                   user_fee_info_temp.fee_ext := 0.00;   
  917.                   user_fee_info_temp.fee_other := 0.00;   
  918.                   user_fee_info_temp.fee_all := 0.00;   
  919.                   user_fee_info_temp.fee_for_others := 0.00;   
  920.                   user_fee_info_temp.fee_by_others := 0.00;   
  921.                 end;   
  922.                 
  923.              --保存到user_fee_info,day_fee_info表   
  924.              select seq_user_fee_info.nextval into user_fee_info_nextval from dual;   
  925.              insert into user_fee_info(fee_id,user_id,fee_base,fee_pkg_month,fee_keep,fee_oth_month,fee_vpn,   
  926.              fee_shift,fee_local,fee_long,fee_inprov,fee_inprov_long,fee_outprov,fee_outprov_long,fee_inter,fee_inter_long,   
  927.              fee_cmnet,fee_trust,fee_ptp_sms,fee_mms,fee_magazine,fee_gprs,fee_wap,fee_data_month,   
  928.              fee_data,fee_ring,fee_display,fee_ext,fee_other,fee_all,fee_for_others,fee_by_others)   
  929.              values(   
  930.              user_fee_info_nextval,base_fee.user_id,   
  931.              decode(sign(base_fee.fee_base-user_fee_info_temp.fee_base),1,base_fee.fee_base-user_fee_info_temp.fee_base,0.00),   
  932.              decode(sign(base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month),1,base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month,0.00),   
  933.              decode(sign(base_fee.fee_keep-user_fee_info_temp.fee_keep),1,base_fee.fee_keep-user_fee_info_temp.fee_keep,0.00),    
  934.              decode(sign(base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month),1,base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month,0.00),     
  935.              decode(sign(base_fee.fee_vpn-user_fee_info_temp.fee_vpn),1,base_fee.fee_vpn-user_fee_info_temp.fee_vpn,0.00),      
  936.              decode(sign(base_fee.fee_shift-user_fee_info_temp.fee_shift),1,base_fee.fee_shift-user_fee_info_temp.fee_shift,0.00),       
  937.              decode(sign(base_fee.fee_local-user_fee_info_temp.fee_local),1,base_fee.fee_local-user_fee_info_temp.fee_local,0.00),       
  938.              decode(sign(base_fee.fee_long-user_fee_info_temp.fee_long),1,base_fee.fee_long-user_fee_info_temp.fee_long,0.00),       
  939.              decode(sign(base_fee.fee_inprov-user_fee_info_temp.fee_inprov),1,base_fee.fee_inprov-user_fee_info_temp.fee_inprov,0.00),       
  940.              decode(sign(base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long),1,base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long,0.00),       
  941.              decode(sign(base_fee.fee_outprov-user_fee_info_temp.fee_outprov),1,base_fee.fee_outprov-user_fee_info_temp.fee_outprov,0.00),       
  942.              decode(sign(base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long),1,base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long,0.00),       
  943.              decode(sign(base_fee.fee_inter-user_fee_info_temp.fee_inter),1,base_fee.fee_inter-user_fee_info_temp.fee_inter,0.00),       
  944.              decode(sign(base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long),1,base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long,0.00),        
  945.              decode(sign(base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet),1,base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet,0.00),         
  946.              decode(sign(base_fee.fee_trust-user_fee_info_temp.fee_trust),1,base_fee.fee_trust-user_fee_info_temp.fee_trust,0.00),          
  947.              decode(sign(base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms),1,base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms,0.00),           
  948.              decode(sign(base_fee.fee_mms-user_fee_info_temp.fee_mms),1,base_fee.fee_mms-user_fee_info_temp.fee_mms,0.00),            
  949.              decode(sign(base_fee.fee_magazine-user_fee_info_temp.fee_magazine),1,base_fee.fee_magazine-user_fee_info_temp.fee_magazine,0.00),             
  950.              decode(sign(base_fee.fee_gprs-user_fee_info_temp.fee_gprs),1,base_fee.fee_gprs-user_fee_info_temp.fee_gprs,0.00),             
  951.              decode(sign(base_fee.fee_wap-user_fee_info_temp.fee_wap),1,base_fee.fee_wap-user_fee_info_temp.fee_wap,0.00),              
  952.              decode(sign(base_fee.fee_data_month-user_fee_info_temp.fee_data_month),1,base_fee.fee_data_month-user_fee_info_temp.fee_data_month,0.00),               
  953.              decode(sign(base_fee.fee_data-user_fee_info_temp.fee_data),1,base_fee.fee_data-user_fee_info_temp.fee_data,0.00),                 
  954.              decode(sign(base_fee.fee_ring-user_fee_info_temp.fee_ring),1,base_fee.fee_ring-user_fee_info_temp.fee_ring,0.00),                  
  955.              decode(sign(base_fee.fee_display-user_fee_info_temp.fee_display),1,base_fee.fee_display-user_fee_info_temp.fee_display,0.00),                  
  956.              decode(sign(base_fee.fee_ext-user_fee_info_temp.fee_ext),1,base_fee.fee_ext-user_fee_info_temp.fee_ext,0.00),                  
  957.              decode(sign(base_fee.fee_other-user_fee_info_temp.fee_other),1,base_fee.fee_other-user_fee_info_temp.fee_other,0.00),                   
  958.              decode(sign(base_fee.fee_all-user_fee_info_temp.fee_all),1,base_fee.fee_all-user_fee_info_temp.fee_all,0.00),                   
  959.              decode(sign(base_fee.fee_for_others-user_fee_info_temp.fee_for_others),1,base_fee.fee_for_others-user_fee_info_temp.fee_for_others,0.00),                   
  960.              decode(sign(base_fee.fee_by_others-user_fee_info_temp.fee_by_others),1,base_fee.fee_by_others-user_fee_info_temp.fee_by_others,0.00) );   
  961.                 
  962.              insert into day_fee_info(id,fee_id,start_time) values(seq_day_fee_info.nextval,user_fee_info_nextval,sysdate-1);   
  963.                 
  964.              commit;   
  965.              exception when others then  
  966.                rollback;   
  967.                dbms_output.put_line('保存到user_fee_info,day_fee_info表出现了异常');   
  968.              end;   
  969.              ------------------(end)-------------------------------    
  970.                 
  971.                 
  972.              -------------------(begin)-----------------------------------------   
  973.              begin  
  974.                 
  975.              --保存到user_fee_info,month_fee_info表   
  976.              begin  
  977.                ----首先删除再更新原来的user_fee_info,month_fee_info   
  978.                     
  979.                 select a.fee_id into v_fee_id  from month_fee_info a, user_fee_info b where a.fee_id = b.fee_id and b.user_id = base_fee.user_id   and to_char(a.start_time,'yyyy-mm') = to_char(add_months(sysdate,-1),'yyyy-mm') ;   
  980.                 delete from user_fee_info x where x.fee_id = v_fee_id;   
  981.                 delete from month_fee_info y where y.fee_id = fee_id;   
  982.                 commit;   
  983.                     
  984.                    
  985.              exception when others then  
  986.                rollback;   
  987.              end;   
  988.                 
  989.              ----插入新的数据   
  990.              select seq_user_fee_info.nextval into user_fee_info_nextval from dual;   
  991.              insert into user_fee_info(fee_id,user_id,fee_base,fee_pkg_month,fee_keep,fee_oth_month,fee_vpn,   
  992.              fee_shift,fee_local,fee_long,fee_inprov,fee_inprov_long,fee_outprov,fee_outprov_long,fee_inter,fee_inter_long,   
  993.              fee_cmnet,fee_trust,fee_ptp_sms,fee_mms,fee_magazine,fee_gprs,fee_wap,fee_data_month,   
  994.              fee_data,fee_ring,fee_display,fee_ext,fee_other,fee_all,fee_for_others,fee_by_others)   
  995.              values( user_fee_info_nextval,base_fee.user_id, base_fee.fee_base, base_fee.fee_pkg_month,   
  996.              base_fee.fee_keep, base_fee.fee_oth_month, base_fee.fee_vpn,   
  997.              base_fee.fee_shift, base_fee.fee_local, base_fee.fee_long, base_fee.fee_inprov,   
  998.              base_fee.fee_inprov_long, base_fee.fee_outprov, base_fee.fee_outprov_long,   
  999.              base_fee.fee_inter, base_fee.fee_inter_long, base_fee.fee_cmnet,   
  1000.              base_fee.fee_trust, base_fee.fee_ptp_sms,  base_fee.fee_mms,   
  1001.              base_fee.fee_magazine,  base_fee.fee_gprs,  base_fee.fee_wap,   
  1002.              base_fee.fee_data_month,  base_fee.fee_data,  base_fee.fee_ring,   
  1003.              base_fee.fee_display, base_fee.fee_ext,  base_fee.fee_other,   
  1004.              base_fee.fee_all,  base_fee.fee_for_others, base_fee.fee_by_others);   
  1005.                
  1006.              insert into month_fee_info(id,fee_id,start_time) values(seq_month_fee_info.nextval,user_fee_info_nextval,sysdate-1);        
  1007.              commit;   
  1008.              exception when others then  
  1009.                rollback;   
  1010.                dbms_output.put_line('保存到user_fee_info,month_fee_info表出现了异常');   
  1011.              end;   
  1012.              ----------------------(end)-----------------------------------------------    
  1013.                  
  1014.            else --不是本月第一天   
  1015.              ------------------------(begin)-------------------------------------   
  1016.              begin  
  1017.              --保存到user_fee_info,day_fee_info表   
  1018.                 
  1019.              begin  
  1020.              --计算出本月的总和   
  1021.                select  user_id,   
  1022.                sum(fee_base),sum(fee_pkg_month),sum(fee_keep),sum(fee_oth_month),sum(fee_vpn),   
  1023.                sum(fee_shift),sum(fee_local),sum(fee_long),sum(fee_inprov),sum(fee_inprov_long),   
  1024.                sum(fee_outprov),sum(fee_outprov_long),sum(fee_inter),sum(fee_inter_long),   
  1025.                sum(fee_cmnet),sum(fee_trust),sum(fee_ptp_sms),sum(fee_mms),sum(fee_magazine),   
  1026.                sum(fee_gprs),sum(fee_wap),sum(fee_data_month),   
  1027.                sum(fee_data),sum(fee_ring),sum(fee_display),sum(fee_ext),sum(fee_other),   
  1028.                sum(fee_all),sum(fee_for_others),sum(fee_by_others)    
  1029.                into user_fee_info_temp from user_fee_info   
  1030.                where user_id = func_get_user_id(group_sims_info.sim)   
  1031.                and fee_id in (select fee_id from day_fee_info where to_char(start_time,'yyyy-mm') = to_char(sysdate,'yyyy-mm'))    
  1032.                group by user_id ;   
  1033.                   
  1034.              exception when others then  
  1035.                   user_fee_info_temp.user_id := base_fee.user_id;   
  1036.                      
  1037.                   user_fee_info_temp.fee_base := 0.00;   
  1038.                   user_fee_info_temp.fee_pkg_month := 0.00;   
  1039.                   user_fee_info_temp.fee_keep := 0.00;   
  1040.                   user_fee_info_temp.fee_oth_month := 0.00;   
  1041.                   user_fee_info_temp.fee_vpn := 0.00;   
  1042.                   user_fee_info_temp.fee_shift := 0.00;   
  1043.                   user_fee_info_temp.fee_local := 0.00;   
  1044.                   user_fee_info_temp.fee_long := 0.00;   
  1045.                   user_fee_info_temp.fee_inprov := 0.00;   
  1046.                   user_fee_info_temp.fee_inprov_long := 0.00;   
  1047.                   user_fee_info_temp.fee_outprov := 0.00;   
  1048.                   user_fee_info_temp.fee_outprov_long := 0.00;   
  1049.                   user_fee_info_temp.fee_inter := 0.00;   
  1050.                   user_fee_info_temp.fee_inter_long := 0.00;   
  1051.                   user_fee_info_temp.fee_cmnet := 0.00;   
  1052.                   user_fee_info_temp.fee_trust := 0.00;   
  1053.                   user_fee_info_temp.fee_ptp_sms := 0.00;   
  1054.                   user_fee_info_temp.fee_mms := 0.00;   
  1055.                   user_fee_info_temp.fee_magazine := 0.00;   
  1056.                   user_fee_info_temp.fee_gprs := 0.00;   
  1057.                   user_fee_info_temp.fee_wap := 0.00;   
  1058.                   user_fee_info_temp.fee_data_month := 0.00;   
  1059.                   user_fee_info_temp.fee_data := 0.00;   
  1060.                   user_fee_info_temp.fee_ring := 0.00;   
  1061.                   user_fee_info_temp.fee_display := 0.00;   
  1062.                   user_fee_info_temp.fee_ext := 0.00;   
  1063.                   user_fee_info_temp.fee_other := 0.00;   
  1064.                   user_fee_info_temp.fee_all := 0.00;   
  1065.                   user_fee_info_temp.fee_for_others := 0.00;   
  1066.                   user_fee_info_temp.fee_by_others := 0.00;   
  1067.                 end;   
  1068.                    
  1069.              --保存到user_fee_info,day_fee_info表   
  1070.              select seq_user_fee_info.nextval into user_fee_info_nextval from dual;   
  1071.              insert into user_fee_info(fee_id,user_id,fee_base,fee_pkg_month,fee_keep,fee_oth_month,fee_vpn,   
  1072.              fee_shift,fee_local,fee_long,fee_inprov,fee_inprov_long,fee_outprov,fee_outprov_long,fee_inter,fee_inter_long,   
  1073.              fee_cmnet,fee_trust,fee_ptp_sms,fee_mms,fee_magazine,fee_gprs,fee_wap,fee_data_month,   
  1074.              fee_data,fee_ring,fee_display,fee_ext,fee_other,fee_all,fee_for_others,fee_by_others)   
  1075.              values(   
  1076.              user_fee_info_nextval,base_fee.user_id,   
  1077.              decode(sign(base_fee.fee_base-user_fee_info_temp.fee_base),1,base_fee.fee_base-user_fee_info_temp.fee_base,0.00),   
  1078.              decode(sign(base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month),1,base_fee.fee_pkg_month-user_fee_info_temp.fee_pkg_month,0.00),   
  1079.              decode(sign(base_fee.fee_keep-user_fee_info_temp.fee_keep),1,base_fee.fee_keep-user_fee_info_temp.fee_keep,0.00),    
  1080.              decode(sign(base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month),1,base_fee.fee_oth_month-user_fee_info_temp.fee_oth_month,0.00),     
  1081.              decode(sign(base_fee.fee_vpn-user_fee_info_temp.fee_vpn),1,base_fee.fee_vpn-user_fee_info_temp.fee_vpn,0.00),      
  1082.              decode(sign(base_fee.fee_shift-user_fee_info_temp.fee_shift),1,base_fee.fee_shift-user_fee_info_temp.fee_shift,0.00),       
  1083.              decode(sign(base_fee.fee_local-user_fee_info_temp.fee_local),1,base_fee.fee_local-user_fee_info_temp.fee_local,0.00),       
  1084.              decode(sign(base_fee.fee_long-user_fee_info_temp.fee_long),1,base_fee.fee_long-user_fee_info_temp.fee_long,0.00),       
  1085.              decode(sign(base_fee.fee_inprov-user_fee_info_temp.fee_inprov),1,base_fee.fee_inprov-user_fee_info_temp.fee_inprov,0.00),       
  1086.              decode(sign(base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long),1,base_fee.fee_inprov_long-user_fee_info_temp.fee_inprov_long,0.00),       
  1087.              decode(sign(base_fee.fee_outprov-user_fee_info_temp.fee_outprov),1,base_fee.fee_outprov-user_fee_info_temp.fee_outprov,0.00),       
  1088.              decode(sign(base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long),1,base_fee.fee_outprov_long-user_fee_info_temp.fee_outprov_long,0.00),       
  1089.              decode(sign(base_fee.fee_inter-user_fee_info_temp.fee_inter),1,base_fee.fee_inter-user_fee_info_temp.fee_inter,0.00),       
  1090.              decode(sign(base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long),1,base_fee.fee_inter_long-user_fee_info_temp.fee_inter_long,0.00),        
  1091.              decode(sign(base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet),1,base_fee.fee_cmnet-user_fee_info_temp.fee_cmnet,0.00),         
  1092.              decode(sign(base_fee.fee_trust-user_fee_info_temp.fee_trust),1,base_fee.fee_trust-user_fee_info_temp.fee_trust,0.00),          
  1093.              decode(sign(base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms),1,base_fee.fee_ptp_sms-user_fee_info_temp.fee_ptp_sms,0.00),           
  1094.              decode(sign(base_fee.fee_mms-user_fee_info_temp.fee_mms),1,base_fee.fee_mms-user_fee_info_temp.fee_mms,0.00),            
  1095.              decode(sign(base_fee.fee_magazine-user_fee_info_temp.fee_magazine),1,base_fee.fee_magazine-user_fee_info_temp.fee_magazine,0.00),             
  1096.              decode(sign(base_fee.fee_gprs-user_fee_info_temp.fee_gprs),1,base_fee.fee_gprs-user_fee_info_temp.fee_gprs,0.00),             
  1097.              decode(sign(base_fee.fee_wap-user_fee_info_temp.fee_wap),1,base_fee.fee_wap-user_fee_info_temp.fee_wap,0.00),              
  1098.              decode(sign(base_fee.fee_data_month-user_fee_info_temp.fee_data_month),1,base_fee.fee_data_month-user_fee_info_temp.fee_data_month,0.00),               
  1099.              decode(sign(base_fee.fee_data-user_fee_info_temp.fee_data),1,base_fee.fee_data-user_fee_info_temp.fee_data,0.00),                 
  1100.              decode(sign(base_fee.fee_ring-user_fee_info_temp.fee_ring),1,base_fee 
posted @ 2012-11-22 15:35  jsping68  阅读(223)  评论(0编辑  收藏  举报