1.select a into temp from A where 1<>1;会产生null异常请问怎么处理?不要先做一个count(a)的查询来判断,那样查询两遍效率低。
2.表A
BeginMSISDN       EndMSISDN      UserType
13512354001       13512355000    神州行
13512355001       13512356000    动感地带
13512356001       13512357000    本地通
13512357001       13512358000    神州行
13512358001       13512359000    动感地带
13512359001       13512360000    神州行
表B
MSISDN            PayType
13512354001       预付费
13512355001       后付费
13512356001       预付费
13512357001       后付费
13512358001       后付费
13512359001       预付费
13512360001       后付费
13512356101       预付费
要求删除B表中神州行用户的信息,请问该如何写,谢谢~~~

解决方案 »

  1.   

    delete from 表B t1 where exists (
    select 1 from 表A t2 where t2.UserType='神州行' and 
    to_number(t1.MSISDN)>=to_number(t2.BeginMSISDN) and
    to_number(t1.MSISDN)<=to_number(EndMSISDN) )
      

  2.   

    类型为神州行的B.BeginMSISDN和B.EndMSISDN可能是多个区间,这个可以实现吗?
    谢谢~~~
    大虾多多支持啊
      

  3.   

    上面那个就是多个区间的,你可以SELECT 一下看看