存储过程存在多个EXECEXEC a1
EXEC a2
EXEC a3但是 JAVA获取返回值渠道的是a1的值 
请问如何解决

解决方案 »

  1.   

    存储过程或以返回多个table,你就获取第一个table的值就可以。.net这样做可以,不知道java是否可以
      

  2.   

    大神,有没有直接在存储过程限制返回值的方法,java方法我不能改,只能改存储过程,有没有就是让他返回EXEC a3的方法?谢谢了!!
      

  3.   

    有没有就是让他返回EXEC a3的方法?应该是可以的,你把存储过程帖出来看看
      

  4.   

    把前2个exec中的结果集,分别插入到临时表中,就不会再返回数据。示例:
    exec('select field into #temp1 from tb1 where id = 1')
    exec('select field into #temp2 from tb2 where id = 2')
    exec('select field from tb3 where id = 3')
      

  5.   

     EXEC [Pro_User_Login_Or_Register_Logs_Insert] @MemberId, 0, @RegisterIp, @deviceId, @deviceNo, 

    IF @VisitUserId <> 0
    BEGIN
    -- 邀请人积分增加 
    EXEC [Pro_User_Score_Update] @VisitUserId,@MemberId,'MEMBER','INVITE'
    END
    DROP TABLE #ScoreTable

    --返回数据,用户详细数据
    EXEC Pro_User_Get_Info @MemberId,@MemberId,@RegisterIp,@deviceId,@deviceNo,@longitude,@latitude,@address
      

  6.   


    我现在用的就是你这个方法,觉得太麻烦了 才上来求救的.
    --#1.呵呵,应该无其它方法。
    --#2..NET里可以得到3个结果集,你直接取第三个用就可以。估计JAVA也可以。
    --#3.重新定义前2个存储过程,不返回结果集。
      

  7.   

    把结果插入到临时表,是个好办法,然后再select出你想要的临时表结果
    create table #temp1(...)
    create table #temp2(...)
    create table #temp3(...)insert into #temp1
    exec a1
    insert into #temp2
    exec a2
    insert into #temp3
    exec a3select * from #temp1 (或temp2或temp3)