Error in Java- Parameter was not defined for Stored Procedure

  • My SP is as below

    create procedure ProcGetUserDetails

    @user_id varchar(40),

    @error_code int OUTPUT,

    @error_message char(255) OUTPUT

    begin

    SET NOCOUNT ON;

    BEGIN TRY

    select * from users where user_id = @user_id

    SET @error_code=0

    SET @error_message = 'Success'

    SET NOCOUNT OFF

    RETURN

    END TRY

    BEGIN CATCH

    BEGIN

    SET @error_code=ERROR_NUMBER()

    SET @error_message = ERROR_MESSAGE()

    RETURN

    END

    END CATCH

    end

    When calling this SP from Java gives error "Parameter user_id was not defined for Stored Procedure ProcGetUserDetails"

    Surprisingly this error doesn't appear everytime. It appears sometimes and mostly when the DB is blank, that is there is no data in the DB. And after restarting the application, it starts working properly. So what could be the problem ? Is it JDBC driver problem ? Has anyone faced this problem ?

  • There doesn't appear to be anything in the SP that would create an error, so, yes it does sound like a java or jdbc problem. I'd ask you to post the Java code, but since I don't program in Java I probably wouldn't be able to help, but then again maybe somebody else can.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply