如何执行表中的sql sql语句:
select 'insert into temp values ('||hostname|| ','||'百度'||')' from url_templet
sql拼接,结果就是
insert into temp values (www.52yeyou.com,百度)
insert into temp values (game4.191pk.com,百度)
insert into temp values (88.198game.net,百度)
insert into temp values (www.xxp001.com,百度)
insert into temp values (vda.uuzu.com,百度)
insert into temp values (game.luokelai.com.cn,百度)
insert into temp values (act.woniu.com,百度)
insert into temp values (bto.youxiya.com,百度)
要怎么执行这些语句,只能用sql执行,不能导数据执行
oraclesql执行sql
分享到:
------解决方案-------------------- 用匿名代码块吧
declare
var_hostname varchar2(64);
cursor cur_hostname is
select hostname from url_templete;
begin
var_hostname := '';
for cur in var_hostname loop
insert into temp values (cur.hostname ------解决方案-------------------- ',' ------解决方案-------------------- '百度');
end loop;
commit;
end;