v_sqlInsert := 'insert into'||v_ktTable||'select * from '||v_crmTable||'@CRM4'
||'where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlInsert;
在execute immediate 这行会报错。源码为:
declare
v_crmTable varchar2(30);
v_ktTable varchar2(30);
v_sqlInsert varchar2(200);
v_sqlUpdate varchar2(200);
begin
for i in 200.. 210
loop
v_crmTable := 'aicbs.ps_provision_'||i;
v_ktTable := 'kt.ps_provision_'||i;
v_sqlInsert := 'insert into'||v_ktTable||'select * from '||v_crmTable||'@CRM4'
||'where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlInsert;
v_sqlUpdate := 'update'||v_crmTable||'@CRM4'
||'set notes = ''LOAD'' where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlUpdate;
end loop;
end;
请各位帮忙解决
||'where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlInsert;
在execute immediate 这行会报错。源码为:
declare
v_crmTable varchar2(30);
v_ktTable varchar2(30);
v_sqlInsert varchar2(200);
v_sqlUpdate varchar2(200);
begin
for i in 200.. 210
loop
v_crmTable := 'aicbs.ps_provision_'||i;
v_ktTable := 'kt.ps_provision_'||i;
v_sqlInsert := 'insert into'||v_ktTable||'select * from '||v_crmTable||'@CRM4'
||'where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlInsert;
v_sqlUpdate := 'update'||v_crmTable||'@CRM4'
||'set notes = ''LOAD'' where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlUpdate;
end loop;
end;
请各位帮忙解决
解决方案 »
- oracle自动重启
- 我有一需求,但不知道该如何设计表机构,而且界面也不知如何设计??在线求教。。
- 高分求:怎么在存储过程里调用sqlldr??在线等.
- : 数据集ds1的 sql异常:ORA-01008: 并非所有变量都已绑定
- 请教: oracle中的datetime的日期时间存储依据
- 求助:处理大数据量越来越慢,不知道是数据库端的瓶颈还是应用程序端瓶颈?
- 在Oricle存储过程中,如何判断一个变量是否含有某段字符?
- 菜鸟问题!如何把一个库里面的所有表和数据导出,到另外一台机器上,类似于复制的功能!在线等,解决马上给分
- 怎样在SQL Server中
- 有关db link的问题
- ORACLE行相减怎么处理
- Mysql 和 ORacle 创建表的区别 ???
这一行 会生成类似于 insert into tabselect * from 这样的sql语句,表名和select 中没有分开。
declare
v_crmTable varchar2(30);
v_ktTable varchar2(30);
v_sqlInsert varchar2(200);
v_sqlUpdate varchar2(200);
begin
for i in 200.. 210
loop
v_crmTable := 'aicbs.ps_provision_'||i;
v_ktTable := 'kt.ps_provision_'||i;
v_sqlInsert := 'insert into '||v_ktTable||
' select * from '||v_crmTable||'@CRM4'||--v_crmTable||'@CRM4'
' where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlInsert;
v_sqlUpdate := 'update '||v_crmTable||' @CRM4'||--
'set notes = ''LOAD'' where action_id=4 and ps_net_code not in(''6E'',''6F'',''6G'',''6H'')';
execute immediate v_sqlUpdate;
end loop;
end;
--上面注释的地方,@CRM4这是什么,insert ...select ...语句应该是像下面这样的
--还有注意空格
insert into table_name
select * from table_name_2
where conditions