出错!求救!
在MSSQL数据库里执行一个存储过程没有问题!
但是,
用JSP调用这个过程就有问题!
一到第62个记录就会终止!
这个过程如下:
create proc batch_dh
(
@id char(10)
)
as
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch in c:\upload\batch.txt -c -q -S"sidi" -U"" -P""'
declare batch_cur cursor for select left(mobile,11) from batch
open batch_cur
declare @mobile char(11)
fetch next from batch_cur into @mobile
while @@fetch_status=0
begin
if left(@mobile,3) not in ('130','131','132','133') or len(@mobile)<>11
begin
insert batch_nul(name,mobile,starttime,state,item)
values(@id,@mobile,getdate(),1,'dh')
end
else
begin
if exists(select mobile from ticq.dbo.tdtuserinfo where left(mobile,11)=@mobile) or exists(select mobile from ticq.dbo.tdt_history where left(mobile,11)=@mobile)
begin
insert batch_fal(name,mobile,starttime,state,item)
values(@id,@mobile,getdate(),1,'dh')
end
else
begin
insert batch_suc(name,mobile,starttime,state,item)
values(@id,@mobile,getdate(),1,'dh')
end
end
fetch next from batch_cur into @mobile
end
close batch_cur
deallocate batch_cur
delete from batch
declare batch_add cursor
for select mobile from batch_suc where item='dh' and state=1
open batch_add
declare @mobile_add char(11)
fetch next from batch_add into @mobile_add
while @@fetch_status=0
begin
exec add_dh @mobile_add,@id
fetch next from batch_add into @mobile_add
end
close batch_add
deallocate batch_add
insert batch
select mobile from batch_suc where item='dh' and state=1
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch out c:\upload\suc.txt -c -q -S"sidi" -U"" -P""'
delete from batch
insert batch
select mobile from batch_fal where item='dh' and state=1
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch out c:\upload\fal.txt -c -q -S"sidi" -U"" -P""'
delete from batch
insert batch
select mobile from batch_nul where item='dh' and state=1
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch out c:\upload\nu.txt -c -q -S"sidi" -U"" -P""'
delete from batch
调用代码如下
CallableStatement cstm1=con.prepareCall("{call temp2.dbo.batchzc_dh_1(?,?)}");
cstm1.setString(1,tempid);
cstm1.setString(2,gongsi);
cstm1.execute();
cstm1.close();
CallableStatement cstm2=con.prepareCall("{call temp2.dbo.batchzc_dh_3(?)}");
cstm2.setString(1,tempid);
cstm2.execute();