- 论坛徽章:
- 0
|
程序执行后,报sqlcode =710的错误相关代码如下:
$prepare sel_d2 from "select distinct acct_id from tb_cust_acct where state='10A'";
$declare sel_d2_acct cursor for sel_d2;
$open sel_d2_acct;
$begin work;
while (1)
{
$fetch sel_d2_acct into :acct_id;
if (SQLCODE==100)
{
printf("deal %s success over\n",tabname);
sprintf(log_str,"deal %s success over",tabname);
write_log(log_str);
break;
}
sprintf(sql_str,"insert into %s select * from %s@%s:%s where acct_id=?",tabname,dbname,server,tabname);
$prepare in_d2_record from :sql_str;
$execute in_d2_record using :acct_id;
if (SQLCODE<0)
{
printf("deal d2 type error!\nsql_str is %s\nsql_code is %d,acct_id=%d",sql_str,SQLCODE,acct_id);
sprintf(log_str,"deal d2 type error!\nsql_str is %s\nsql_code is %d,acct_id=%d",sql_str,SQLCODE,acct_id);
write_log(log_str);
$rollback work;
break;
}
$free in_d2_record;
}
/*$commit work;*/
$free sel_d2_acct;
$free sel_d2;
}
不用游标处理,代码修改如下后,程序处理通过:
sprintf(sql_str,"insert into %s select * from %s@%s:%s where acct_id in (select distinct acct_id from tb_cust_acct where state='10A')",tabname,dbname,server,tabname);
$prepare in_d2_record from :sql_str;
$execute in_d2_record;
if (SQLCODE<0)
{
printf("deal d2 type error!\nsql_str is %s\nsql_code is %d,acct_id=%d",sql_str,SQLCODE,acct_id);
sprintf(log_str,"deal d2 type error!\nsql_str is %s\nsql_code is %d,acct_id=%d",sql_str,SQLCODE,acct_id);
write_log(log_str);
$rollback work;
break;
}
$free in_d2_record;
$commit work;
请问是什么原因造成这种情况!谢高手赐教! |
|