本帖最后由 wrhclone 于 2010-06-24 11:48:35 编辑

解决方案 »

  1.   

    insert into Dest
    select s.ip,s.USER_NAME ,s.PASSWORD,upper(substr(user_name,0,1)),
    nvl((select c.country from country c where  s.ip>c.ipstart  and s.ip<c.ipend ),'OT')
    from Source  s
      

  2.   

    select c.country from country c where  s.ip>c.ipstart  and s.ip<c.ipend
    你要确保输入一个IP只能得到一条记录,否则报错...
      

  3.   

    insert into dest select ip,USER_NAME,PASSWORD,upper (substr (user_name,0,1)),
    (select (case when s.ip>=ipstart and s.ip<=ipend then c.country  else country = 'OT'
    end)  from country c ) from Source  s