MySQL Forums
Forum List  »  Connector/ODBC

Store procedure output variable not set
Posted by: Gary Brookman
Date: January 18, 2018 02:46PM

I'm trying to get the value of a stored procedure output variable but it's always = 0;

// Stored procedure
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `Simple`(OUT oi int)
BEGIN
SET oi = 57;
END$$
DELIMITER ;

Running from workbench I see the 57.

Snippet of pertinent C++

// Bind the output parameter to variable OutParm.
SDWORD OutParm (0);
retcode = SQLBindParameter (g_hstmt, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &OutParm, 0, nullptr);
retcode = SQLExecDirect (g_hstmt, (SQLTCHAR*)L"{call Simple (?)}", SQL_NTS);

Using Visual Studio 2017
MS ODBC driver manager
MySQL ODBC Unicode driver 5.03.09

SQLGetInfo output:
SQL_DBMS_NAME: MySQL
SQL_DBMS_VER: Version: 5.7.20-log
SQL_ODBC_VER: 03.80.0000
SQL_DRIVER_VER: 05.03.0009
SQL_DRIVER_ODBC_VER: 03.80
SQL_ODBC_INTERFACE_CONFORMANCE: 2

SQLProcedureColumns output:
Ordinal 1
Parm type 4
Data type 4
Length 4
Column Name oi

I have a similar SP in MS SQL and this works as expected.

Is this a bug? There's no error but I can't get any output parameter type to work. I've tried with the 5.6 server too, same results.

Options: ReplyQuote


Subject
Written By
Posted
Store procedure output variable not set
January 18, 2018 02:46PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.