jdbc sql error: statement did not return a result set

后端 未结 2 1349
不思量自难忘°
不思量自难忘° 2020-12-11 06:47

I have two stored procedures as follows:

create stored procedure p1
as
    select * from table1 where datediff(day, table1.[date], getdate())

create stored          


        
2条回答
  •  一向
    一向 (楼主)
    2020-12-11 07:48

    Your [p2] stored procedure needs to include SET NOCOUNT ON right at the beginning to suppress the "n rows affected" counts so JDBC doesn't get confused as to what it should put into the ResultSet:

    CREATE PROCEDURE p2
    AS
    
    SET NOCOUNT ON;
    
    declare @t1 table(
        ref varchar(20)
    )
    
    -- ... and so on
    

    For more information on SET NOCOUNT see

    SET NOCOUNT (Transact-SQL)

    For more information on precisely what gets returned from a stored procedure call, see

    How to get everything back from a stored procedure using JDBC

提交回复
热议问题