How to get value of an Output Parameter of a MySQL SP with TUniSQL
Posted: Sun 06 Dec 2015 10:08
Hi
I have created a Stored Procedure in a MySQL DataBase that have 2 output parameters like this ( for Example ) :
I want to execute this SP using TUniSQL and get output value of fErr and fMsg, When I use the SP Call Generator of TUniSQL, it generates this SQL :
and output parameters are listed in parameters list of TUniSQL as 'fErr' and 'fMsg' ( Parameter type is Output )
But after executing TUniSQL, there is no Value in 'fErr' and 'fMsg'
Execution done without any error, but for example "TUniSQL.ParamByName('fErr' or 'fMsg').AsString" returns an empty String !
I have tried setting parameters in SP like this :
But the problem exists
These parameters are empty too when I use TUniStoredProc instead of TUniSQL !
Is there problem in SP ( problem in setting value of parameters ) ?
I`m using Delphi XE6 and UniDAC 6.1
I have created a Stored Procedure in a MySQL DataBase that have 2 output parameters like this ( for Example ) :
Code: Select all
CREATE PROCEDURE `invite_user`(fUName VARCHAR(15) CHARSET utf8, fRegCode VARCHAR(15) CHARSET utf8, fEmail VARCHAR(30) CHARSET utf8, fInviter VARCHAR(15) CHARSET utf8,
OUT fErr INT, OUT fMsg VARCHAR(255) CHARSET utf8)
BEGIN
...
IF (@C = 0) THEN
...
SET fErr = 0;
SET fMsg = '';
ELSE
SET fErr = 1;
SET fMsg = 'Not Found !';
END IF;
END
Code: Select all
CALL invite_user(:fUName, :fRegCode, :fEmail, :fInviter, @fErr, @fMsg);
SELECT CAST(@fErr AS SIGNED) AS '@fErr', @fMsg AS '@fMsg'
But after executing TUniSQL, there is no Value in 'fErr' and 'fMsg'
Execution done without any error, but for example "TUniSQL.ParamByName('fErr' or 'fMsg').AsString" returns an empty String !
I have tried setting parameters in SP like this :
Code: Select all
SET @fErr = 0;
These parameters are empty too when I use TUniStoredProc instead of TUniSQL !
Is there problem in SP ( problem in setting value of parameters ) ?
I`m using Delphi XE6 and UniDAC 6.1