db2存储过程报错,求大神解答
存储过程:begindeclarevarTabName1varchar(20);declarevarTabName2varchar(20);declarecycle_en...
存储过程:
begin
declare varTabName1 varchar(20);
declare varTabName2 varchar(20);
declare cycle_end int default 0;
declare var_sql varchar(2000);
declare cursor1 cursor for select mysql_tabname,db2_tabname from bir.test;
select count(*) into cycle_end from bir.test ;
open cursor1;
fetch cursor1 into varTabName1,varTabName2;
while cycle_end>0 do
set var_sql='load from ''/home/db2inst1/tmp/'||varTabName1||'.txt''of del modified by codepage=1208 replace into'||varTabName2;
execute immediate var_sql;
fetch cursor1 into varTabName1,varTabName2;
set cycle_end=cycle_end-1;
end while;
close cursor1;
end
运行报错: [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=load from '/home/db2inst1/tmp/oss.te;BEGIN-OF-STATEMENT;<variable_set>, DRIVER=4.13.127
目的是为了将数据导入表中 展开
begin
declare varTabName1 varchar(20);
declare varTabName2 varchar(20);
declare cycle_end int default 0;
declare var_sql varchar(2000);
declare cursor1 cursor for select mysql_tabname,db2_tabname from bir.test;
select count(*) into cycle_end from bir.test ;
open cursor1;
fetch cursor1 into varTabName1,varTabName2;
while cycle_end>0 do
set var_sql='load from ''/home/db2inst1/tmp/'||varTabName1||'.txt''of del modified by codepage=1208 replace into'||varTabName2;
execute immediate var_sql;
fetch cursor1 into varTabName1,varTabName2;
set cycle_end=cycle_end-1;
end while;
close cursor1;
end
运行报错: [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=load from '/home/db2inst1/tmp/oss.te;BEGIN-OF-STATEMENT;<variable_set>, DRIVER=4.13.127
目的是为了将数据导入表中 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询