More info when catching exceptions #362
Replies: 2 comments 1 reply
-
https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlfetch-function says:
which suggests to me indicator buffer is not being set correctly and is null pointer. You will need to debug and investigate the what binding does for your case. I don't know any other reasons for this message. Try stepping through |
Beta Was this translation helpful? Give feedback.
-
So in my case, my stored procedure had a try/catch block that would rollback the transaction if any errors were raised. The output parameters were not being set in the catch block, so if an exception was raised in the stored proc before the variables were set, then at the end of the call, the parameters would still be null, and thus the indicator variable required warning would be displayed. It is worth noting that the indicator variable message would be the message of the c++ exception, rather than the message of the raised error in the stored procedure. So for future people who find themselves here, make sure all code paths of your stored procedure set values for output parameters. Even if there is no exception raised and you don't use the parameters in c++, it will still issue this warning if you do not set your parameters. |
Beta Was this translation helpful? Give feedback.
-
Is there any way to get more information about what is going wrong when calling my stored procedure?
I am getting the error "Indicator variable required but not supplied" and I am unsure as to why.
I am calling a stored procedure in a MSSQL Server 2008 Database from a program on an ubuntu 20.04 computer using nanodbc.
Here is an example of my code:
When the stored procedure fails, it prints out:
From what I can tell, if my procedure returns null for any of the output parameters, then this error will be displayed.
However, at the end of the stored procedure I do an isnull around each of the variables to ensure that all output params are not null.
Can this message be displayed if the procedure times out? Is there any other reason for this message to be displayed?
Can I see what the procedure does return even if it does not return all the variables? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions