假设过程为  test1(参数1 ,参数2 )
其中一个为输出参数(自己不知道哪个是)
我在java中直接 使用callablestatement    = connection.prepareCall("{call  test(100,200)}
下面没有使用 callablestatement.registerOutParameter 进行注册参数
也不使用callablestatement.getString(index)获取输出参数,因为我不知道第几个是输出参数
在callablestatement.execute()之后,有什么办法能获取该存储过程的输出参数

解决方案 »

  1.   

    /*
    功能说明:计算新的YYYYMM日期格式(原YYYYMM、变化数值、新YYYYMM变量为必需参数)
    调用方式:execute P_PuCalcYYYYMM 原YYYYMM,变化数值,新YYYYMM
    eg:
    declare @BEGYYYYMM char(6)
    execute P_PuCalcYYYYMM '200507','1',@BEGYYYYMM output
    select @BEGYYYYMM
    --得到200508
    */ALTER Procedure [dbo].[P_PuCalcYYYYMM]
    @oldYYYYMM char(6),
    @varMonth int,
    @newYYYYMM char(6) output
    AS
    declare @newMonth datetime
    set @newMonth=dateadd(month,@varMonth,cast((@oldYYYYMM+'01') as datetime))if len(month(@newMonth))=1
    set @newYYYYMM=ltrim(str(year(@newMonth)))+'0'+ltrim(str(month(@newMonth)))
    else
    set @newYYYYMM=ltrim(str(year(@newMonth)))+ltrim(str(month(@newMonth)))