• sql模糊查询,解除绑定的单号


    --610007570320-610007571319  1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007570320
                    and TO_NUMBER(bill_code) <= 610007571319);
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007570320
                    and TO_NUMBER(bill_code) <= 610007571319);
    --    610007572320-610007573319  1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007572320
                    and TO_NUMBER(bill_code) <= 610007573319);
    --610007571320-610007572319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007571320
                    and TO_NUMBER(bill_code) <= 610007572319);
    --610007585320-610007586319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007585320
                    and TO_NUMBER(bill_code) <= 610007586319);
    --      610007582320-610007583319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007582320
                    and TO_NUMBER(bill_code) <= 610007583319);
    --610007575320-610007576319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007575320
                    and TO_NUMBER(bill_code) <= 610007576319);
    --  610007568320-610007569319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007568320
                    and TO_NUMBER(bill_code) <= 610007569319);
    --610007578320-610007579319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007578320
                    and TO_NUMBER(bill_code) <= 610007579319);
    --610007586320-610007587319 1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007586320
                    and TO_NUMBER(bill_code) <= 610007587319);
    --610007550320-610007551319 1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007550320
                    and TO_NUMBER(bill_code) <= 610007551319);
    --610007558940-610007559319 380张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007558940
                    and TO_NUMBER(bill_code) <= 610007559319);
    --610007556320-610007557319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007556320
                    and TO_NUMBER(bill_code) <= 610007557319);
    --610007589320-610007590319 1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007589320
                    and TO_NUMBER(bill_code) <= 610007590319);
    --610007564320-610007565319 1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007564320
                    and TO_NUMBER(bill_code) <= 610007565319);
    --610007581320-610007582319 1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007581320
                    and TO_NUMBER(bill_code) <= 610007582319);
    --610007569320-610007570319 1000张
    
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007569320
                    and TO_NUMBER(bill_code) <= 610007570319);
    
    --610007552320-610007553319 1000张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007552320
                    and TO_NUMBER(bill_code) <= 610007553319);
    --610007558460-610007558819 360张
    delete from (select t.*
                   from (select t1.bill_code, t1.bind_code, t1.use_flag
                           from t_mm_section_sl t1
                          where t1.bill_code like '6100075%') t
                  where TO_NUMBER(bill_code) >= 610007558460
                    and TO_NUMBER(bill_code) <= 610007558819);
    commit;

     注:开始的时候写的下面的,一直报错,原因是bill_code的值有是字母的,所以后来就过滤掉那些不是纯数字的单号,再用to_number就好了

    
    
  • 相关阅读:
    什么是内存泄漏,为什么会导致内存溢出?
    深入了解Redis(1)字符串底层实现
    深入了解Redis(3)对象
    201871010135 张玉晶《面向对象程序设计(java)》第十一周学习总结
    201871010135 张玉晶 《面向对象程序设计(java)》第二周学习总结
    201871010135 张玉晶《面向对象程序设计(java)》第十二周学习总结
    20187101035 张玉晶《面向对象程序设计(java)》第八周学习总结
    201871010135 张玉晶 《2019面向对象程序设计(java)课程学习进度条》
    201871010135张玉晶《面向对象程序设计(Java)》第四周学习总结
    201871010135 张玉晶《面向对象程序设计(java)》第七周学习总结
  • 原文地址:https://www.cnblogs.com/feifeicui/p/8961078.html
Copyright © 2020-2023  润新知