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
select c.country from country c where s.ip>c.ipstart and s.ip<c.ipend 你要确保输入一个IP只能得到一条记录,否则报错...
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
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
你要确保输入一个IP只能得到一条记录,否则报错...
(select (case when s.ip>=ipstart and s.ip<=ipend then c.country else country = 'OT'
end) from country c ) from Source s