惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
J
Java Code Geeks
小众软件
小众软件
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
腾讯CDC
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
量子位
M
MIT News - Artificial intelligence
Last Week in AI
Last Week in AI
L
LangChain Blog

博客园 - ivanking

(转载)常用格式转换 smil教程(转载) Nhibernate之初体验(一) 构建安全的Web Service Getting start with nhibernate) CrystalReport开发常见错误总结 SQL Server日志文件的相关处理(转帖) 常用正则表达式收集 - ivanking - 博客园 Nov 2th 2005 Aug 13th 2005 Sep 5th 2005 ---- Sep 12th 2005 Aug 26th 2005 优化较大数据量的处理效率的收获(总结,疑问) 优化较大数据量的处理效率的收获(sql性能优化) 优化较大数据量的处理效率的收获(优化思路) 优化较大数据量的处理效率的收获(寻找瓶颈) 优化较大数据量的处理效率的收获(前言) 在域控制器上vs.net 2003无法调试的解决办法 几个js验证函数 - ivanking - 博客园
Aug 31th 2005
ivanking · 2005-08-31 · via 博客园 - ivanking

1修改欠费用户bug,原来程序中批量导入时判断user_push_time表没有根据policyid和username结合,而是单独根据username判断
 2、修改删除的逻辑错误,原来删除后所有推送策略的validflag都置为0

修改后的存储过程

CREATE OR REPLACE Procedure due_ImportArrearsUser
(
p_policyId        
In               ics001.user_push_times.policyid%Type,
p_result          Out              
Integer
---  -1001,ɾ³ýÁÙʱ±íÖÐÔÚ°×Ãûµ¥ÖдæÔڵļǼʱ³ö´í
--
-  -1002,ɾ³ýÁÙʱ±íÖÐÓëdue_user±íÖÐÖØ¸´µÄ¼Ç¼³ö´í
--
-  -1003,½«ÁÙʱ±íÖеÄÊý¾Ý²åÈëdue_user±í³ö´í
--
-  -1004,ÁÙʱ±íÖÐÔÚuser_push_time±íÖÐÒÑÓеļǼ£¬¸üгö´í
--
-  -1005,ÁÙʱ±íÖв»´æÔÚÓÚuser_push_time±íÖеļǼ£¬²åÈë³ö´í
--
-  -1006,Çå¿ÕÁÙʱ±íÊý¾Ý³ö´í
--
-   0,³É¹¦
)
Is
v_userCount 
Integer;

Begin
  
-----½«ÁÙʱ±ídue_user_temp±íÖв»ÔÚ°×Ãûµ¥ÖкÍÓÚdue_user²»Öظ´µÄ¼Ç¼²åÈëdue_user
     /*Insert Into due_user
     Select a.*  
     From due_user_temp a,due_user b, due_whiteuser c 
     Where ( a.province = b.province And a.city = b.city) And (a.username=b.username(+)  And b.username Is Null) )
     And (a.province = c.province And a.city = c.city And (a.username = c.username(+) And c.username Is Null) )
*/

     
     
-----ɾ³ýÁÙʱ±íÖÐÔÚ°×Ãûµ¥ÖдæÔڵļǼ------
     
     
Delete From due_user_temp a
     
Where ExistsSelect 1 
                   
From due_whiteuser b 
                   
Where a.username = b.username And a.province = b.province And a.city = b.city );
                   
      
/*If Sql%Notfound Then
          p_result := -1001;
          Return;
       End If;  
*/
            
     
     
     
-----ɾ³ýÁÙʱ±íÖÐÓëdue_user±íÖÐÖØ¸´µÄ¼Ç¼---
     Delete From due_user_temp a
     
Where ExistsSelect 1 
                   
From due_user b 
                   
Where a.username = b.username And a.province = b.province And a.city = b.city );
     
     
/*If Sql%Notfound Then
          p_result := -1002;
          Return;
       End If;
*/
 
       
     
---commitÁÙʱ±íÖеÄÊý¾Ý¸ü¸Ä££££              
     --Commit;
     
     
-----½«ÁÙʱ±íÖеÄÊý¾Ý²åÈëdue_user±í----
     Insert Into due_user
     
Select * From due_user_temp;
     
     
/*If Sql%Notfound Then
          p_result := -1003;
          Return;
       End If; 
*/

     
     
----¸ù¾ÝÁÙʱ±íÖеÄÊý¾Ý,update»òinsert ics001.user_push_times±í---
     ----ÁÙʱ±íÖÐÔÚuser_push_time±íÖÐÒÑÓеļǼ£¬¸üÐÂ-----
     Update
       (
Select push.validflag, push.pushtimes,push.pushdaytimes, push.lastpushedtime
       
From ics001.user_push_times push, due_user_temp temp
       
Where push.username = temp.username And push.policyid = p_policyId)
     
Set validflag = 1, pushtimes = 0, pushdaytimes = 0, lastpushedtime = 0;
     
     
/*If Sql%Notfound Then
          p_result := -1004;
          Return;
       End If; 
*/

     
     
---ÁÙʱ±íÖв»´æÔÚÓÚuser_push_time±íÖеļǼ£¬²åÈë----
     INSERT INTO ics001.user_push_times(username,ip,policyid,pushtimes,pushdaytimes,validflag,fileId,createtime)
      
Select temp.username, 0, p_policyId, 001999997, Sysdate 
      
From due_user_temp temp Left Outer Join (Select push.username 
                                              
From ics001.user_push_times push 
                                              
Where policyid=p_policyId) push  
      
On temp.username = push.username
      
Where  push.Username Is Null;
      
      
/*If Sql%Notfound Then
          p_result := -1005;
          Return;
       End If; 
*/

     
     
Select Count* ) Into v_userCount From due_user_temp;
     
If(v_userCount > 0 ) Then
         
Begin
              
Delete From due_user_temp;
              
              
If Sql%Notfound Then
              p_result :
= -1006;
              
Return;
              
End If;
         
End;
    
End If;
       
    p_result :
= v_userCount;
    
Return;
       
     
     
End due_importarrearsuser;