我在正常的过程里可以正常执行返回值如
CREATE proc cb_AuthCommit(@szAcctId   varchar(40),
                          @szCalledA  varchar(40),
                          @nDuration int = 0 output, 
                          @nRet int = 0 output) SET @nDuration ='3434'但是我在过程里加了个循环记录的游标 就无论也返回不了值了 我的游标是
declare   tb   cursor for  select  ldwg,jqqz,zjqz   from   lyjh   where lyjh =@wgid
declare @a1 varchar(10)
declare @a2 varchar(10)
declare @a3 varchar(10)  open   tb   
  fetch   next   from   tb   
  while   @@fetch_status=0   
  begin   
 INSERT voipswitch.dbo.DialingPlan(telephone_number,priority,route_type,tech_prefix,dial_as,id_route,call_type,type) VALUES(@nFeeValue1A,'0',0,'CP:!013863012300; ','9',@a1,0,0)
                fetch   next   from   tb   into   @a1,@a2, @a3
  end   
  close   tb   
  deallocate    tb

解决方案 »

  1.   

    你要返回DialingPlan表的记录吗??declare   tb   cursor for  select  ldwg,jqqz,zjqz   from   lyjh   where lyjh =@wgid
    declare @a1 varchar(10)
    declare @a2 varchar(10)
    declare @a3 varchar(10)  open   tb   
      fetch   next   from   tb   
      while   @@fetch_status=0   
      begin   
     INSERT voipswitch.dbo.DialingPlan(telephone_number,priority,route_type,tech_prefix,dial_as,id_route,call_type,type) VALUES(@nFeeValue1A,'0',0,'CP:!013863012300; ','9',@a1,0,0)
                    fetch   next   from   tb   into   @a1,@a2, @a3
      end   
      close   tb   
      deallocate    tb
    --在存储过程中加一句select * from DialingPlan