HELP: FUNCTION and PROCEDURE best practices.... Hi All,
Got a best practices question....
I often have to write PROCEDURES that return a value (because it needs
to have a transaction in it)...and I can't do that in a FUNCTION.
eg
CREATE PROCEDURE `sp_test01`()
BEGIN
START TRANSACTION;
-- Do some insert
COMMIT;
SELECT 1;
END$$
This makes it very easy to get a return value from the CALL sp_test01()
from, for example, C#....set it up.....ExecuteScalar.
However, it doesn't allow me to call this and get a return value from
within another PROCEDURE.
eg.
CALL sp_test01() INTO var_X;
now I know I can use an OUT parameter for the procedure, but coding for
that in C# is a pain. Most specifically its that in order to get the
OUT parameter ALL the parameters HAVE to be defined EXACTLY as they are
in the stored procedure.
So is there another way I can do this?
Regards
D. |