CallableStatement cstmt = con.prepareCall(sql);
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.setString(2, "111");
cstmt.setInt(3, 0);
cstmt.setString(4, "");
cstmt.setInt(5, 10);
cstmt.setInt(6, 0);
cstmt.execute();
rs = cstmt.getResulset();
rs每次取出都是null,谁能帮我分析下为什么吗?
SP_CIMS_ZDCX 存储过程可以返回2个结果集
7 个解决方案
#1
SP内容?是类似 in('a','b')?
#2
CREATE PROCEDURE dbo.SP_CIMS_ZDCX(
@VAR_PARM1 char(18) = '',
@VAR_PARM2 int = 0,
@VAR_PARM3 CHAR(10) = '',
@VAR_PAGESET INT = 0,
@VAR_PAGEINDEX INT = 0
)
AS
BEGIN
DECLARE @RowCount int
--结果集1
SELECT *
FROM TABLE1
WHERE CODE = @VAR_PARM3
SELECT RowCount = 10
--结果集2
SELECT @RowCount AS ROW_COUNT
return 0
END
简单的贴下那个存储过程
@VAR_PARM1 char(18) = '',
@VAR_PARM2 int = 0,
@VAR_PARM3 CHAR(10) = '',
@VAR_PAGESET INT = 0,
@VAR_PAGEINDEX INT = 0
)
AS
BEGIN
DECLARE @RowCount int
--结果集1
SELECT *
FROM TABLE1
WHERE CODE = @VAR_PARM3
SELECT RowCount = 10
--结果集2
SELECT @RowCount AS ROW_COUNT
return 0
END
简单的贴下那个存储过程
#3
还有奇怪的是,我retcode取存储过程returnstatus是能取到的,就是取结果集为null
#4
SELECT @RowCount AS ROW_COUNT
你的这个 @RowCount 在哪一句对它赋值了呢?
你的这个 @RowCount 在哪一句对它赋值了呢?
#5
你返回1个结果集试试
#6
ACMAIN_CHM ,那句是我写漏了,上句应该是SELECT @RowCount = 10 ,
WWWWA,我试过把结果集2注释掉,但还是一个取不到啊,如果直接用rs = cstmt.executeQuery(),能取到,但多结果集就不好取了
WWWWA,我试过把结果集2注释掉,但还是一个取不到啊,如果直接用rs = cstmt.executeQuery(),能取到,但多结果集就不好取了
#7
多结果集确实不好取,存入表中再取吧
#1
SP内容?是类似 in('a','b')?
#2
CREATE PROCEDURE dbo.SP_CIMS_ZDCX(
@VAR_PARM1 char(18) = '',
@VAR_PARM2 int = 0,
@VAR_PARM3 CHAR(10) = '',
@VAR_PAGESET INT = 0,
@VAR_PAGEINDEX INT = 0
)
AS
BEGIN
DECLARE @RowCount int
--结果集1
SELECT *
FROM TABLE1
WHERE CODE = @VAR_PARM3
SELECT RowCount = 10
--结果集2
SELECT @RowCount AS ROW_COUNT
return 0
END
简单的贴下那个存储过程
@VAR_PARM1 char(18) = '',
@VAR_PARM2 int = 0,
@VAR_PARM3 CHAR(10) = '',
@VAR_PAGESET INT = 0,
@VAR_PAGEINDEX INT = 0
)
AS
BEGIN
DECLARE @RowCount int
--结果集1
SELECT *
FROM TABLE1
WHERE CODE = @VAR_PARM3
SELECT RowCount = 10
--结果集2
SELECT @RowCount AS ROW_COUNT
return 0
END
简单的贴下那个存储过程
#3
还有奇怪的是,我retcode取存储过程returnstatus是能取到的,就是取结果集为null
#4
SELECT @RowCount AS ROW_COUNT
你的这个 @RowCount 在哪一句对它赋值了呢?
你的这个 @RowCount 在哪一句对它赋值了呢?
#5
你返回1个结果集试试
#6
ACMAIN_CHM ,那句是我写漏了,上句应该是SELECT @RowCount = 10 ,
WWWWA,我试过把结果集2注释掉,但还是一个取不到啊,如果直接用rs = cstmt.executeQuery(),能取到,但多结果集就不好取了
WWWWA,我试过把结果集2注释掉,但还是一个取不到啊,如果直接用rs = cstmt.executeQuery(),能取到,但多结果集就不好取了
#7
多结果集确实不好取,存入表中再取吧