`

oracle存储过程例子(实战项目)

 
阅读更多
Sql代码  收藏代码
  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  


分享到:
评论

相关推荐

    TX_CON_0088_oracle_oracle存储过程实战_

    "TX_CON_0088_oracle_oracle存储过程实战_"这个主题深入探讨了如何在实际环境中应用Oracle存储过程,包括其创建、实现以及后台调用等关键环节。 首先,我们来了解如何创建存储过程。在Oracle中,创建一个存储过程...

    北大青鸟Oracle项目实战

    本示例代码为我们提供了一个关于如何使用Oracle数据库处理XML文档的实际例子。通过学习这些知识点,开发者可以更好地理解和掌握如何利用Oracle数据库的强大功能来处理和操作XML数据,从而提高开发效率并实现更复杂的...

    经过修改的jsf编程实战导航例子14

    在JSF(JavaServer Faces)编程领域,"经过修改的jsf编程实战导航例子14"是一个关于学生班级管理系统的实战项目。这个项目基于《jsf编程实战导航》这本书中的例子,作者对原有的示例进行了扩展和完善,以涵盖更全面...

    itjob绝密oracle培训教程课本+PPT

    4. Oracle存储结构:深入理解表的存储方式,如heap tables、index-organized tables以及B树索引的工作原理。 5. 数据仓库与OLAP:介绍数据仓库设计原则,星型和雪花模式,以及Oracle的OLAP功能如物质化视图、快速聚...

    Oracle Service Bus 11g Development Cookbook

    总而言之,《Oracle Service Bus 11g 开发食谱》是一本不可多得的实战指南,对于使用Oracle Service Bus 11g开发企业级集成解决方案的开发者来说,是一本宝贵的参考资料。通过阅读本书,开发者可以提升自己的技能,...

    PLSQL 实际开发例子

    PLSQL,全称为Procedural Language/SQL,是Oracle数据库提供的一个编程环境,结合了SQL的查询能力与过程式编程语言的功能,使得开发者能够编写存储过程、函数、触发器等数据库对象,从而实现复杂的数据库管理和应用...

    ibatis演示例子

    【描述】"ibatis演示例子 开发环境:eclipse4.3 ibatis2.3 oracle10g"这部分信息表明,开发过程中使用了Eclipse IDE的4.3版本作为开发工具,iBATIS框架的2.3版本,以及Oracle数据库的10g版本。Eclipse是Java开发中...

    关于Java的练习,其中包括Java基础、Java理解、Oracle数据库、servlet等.zip

    同时,了解Oracle数据库的特性,如索引、存储过程、触发器和视图,对于设计高效的数据访问层至关重要。 Servlet是Java Web开发的关键组件,用于扩展Web服务器的功能。Servlet可以接收和响应HTTP请求,生成动态内容...

    ADO.NET数据操作视频实际例子加PPT

    ADO.NET是微软.NET框架下的一种数据访问技术,用于与各种数据库进行交互,包括SQL Server、Oracle、MySQL等。...实际例子将使理论知识更具实践意义,帮助开发者更好地应对实际项目中的数据访问需求。

    人力资源管理系统小例子(JAVA+EXTJS) 含数据库

    数据库部分可能是MySQL、Oracle或其他关系型数据库,用于存储人力资源管理系统的各种数据,如员工个人信息、部门信息、职位信息等。数据库设计的好坏直接影响到系统的性能和扩展性,因此合理的数据库模型和索引优化...

    JAVA+很好的ssh例子,是开始学习的示范性项目Java源码

    SSH在Java开发中是一个非常重要的概念,全称为Spring、...总之,这个"JAVA+很好的ssh例子"是一个宝贵的学习资源,通过深入研究和实践,你可以快速掌握Java企业级开发的核心技术,并为自己的职业道路打下坚实的基础。

    c#数据库编程源码,很多好例子

    `SqlCommand`的`CommandType`属性设置为`StoredProcedure`,即可调用存储过程。源码可能包含调用存储过程并处理返回结果的示例。 6. **参数化查询**: 避免SQL注入攻击的最佳实践是使用参数化查询。`SqlCommand`...

    jsp入门 包含简单的登录注册例子

    【标题】"jsp入门 包含简单的登录注册例子"是一个非常适合初学者的教程,它旨在帮助新接触JavaServer Pages(JSP)技术的开发者...通过这个过程,你将学习到Web开发中的核心概念,为将来更复杂的项目打下坚实的基础。

    图书管理系统,java,servlet例子

    在IT领域,构建一个图书管理系统是一项常见的学习与实战项目,它能够帮助我们深入理解Java编程语言以及Web应用开发中的Servlet技术。本项目以“图书管理系统”为主题,结合Java和Servlet,提供了一个实际的案例分析...

    JavaFX + MySql 实现学生信息管理系统

    JavaFX是Oracle公司推出的一种用于开发桌面、移动和Web应用的现代Java GUI框架。它基于Java语言,提供了丰富的UI控件和动画效果,使得开发者能够轻松创建出美观且交互性强的应用程序。JavaFX支持FXML(FXML是用于...

    《实战JSP开发》源代码loginModule-src.rar

    《实战JSP开发》这本书是针对Java服务器页面(JSP)技术的一本实践教程,旨在帮助读者通过实际项目开发来掌握JSP的核心概念和技术。源代码"loginModule-src.rar"包含的是书中关于登录模块的实现代码,对于学习JSP...

    亮剑.NET深入体验与实战精要3

    读者可以在欣赏一个个有趣例子的过程中,不知不觉具备开发真正商业项目的能力。 本书集实用性、思想性、趣味性于一体,内容共分为技术基础总结、系统架构设计思想及项目实战解析三部分,随书所附光盘收录大量实例...

    ADO连接数据库实战

    在IT行业中,数据库是存储和管理数据的核心工具,而连接数据库是进行数据操作的第一步。在本实战教程中,我们将探讨如何使用ActiveX Data Objects(ADO)技术在MFC(Microsoft Foundation Classes)环境下,通过...

    Java精品项目源码第77期校园人力人事资源管理系统.zip

    5. **数据库设计**:项目中可能涉及到MySQL或Oracle等关系型数据库,用于存储人事资源数据。设计合理的数据库表结构,编写高效的SQL查询语句是项目的关键部分。 6. **Web前端技术**:可能使用HTML、CSS、JavaScript...

    亮剑.NET深入体验与实战精要2

    读者可以在欣赏一个个有趣例子的过程中,不知不觉具备开发真正商业项目的能力。 本书集实用性、思想性、趣味性于一体,内容共分为技术基础总结、系统架构设计思想及项目实战解析三部分,随书所附光盘收录大量实例...

Global site tag (gtag.js) - Google Analytics