I have something like this:
DELIMITER $$
DROP PROCEDURE IF EXISTS test$$
CREATE PROCEDURE test(
IN a_in varchar(3),
IN b_in varchar(3))
begin
select a_in as a, b_in as b;
end $$
DELIMITER ;
CALL test('1', '2');
I do not want to modify the SP and make it write to a temporary table. I am trying to write some unit tests for the SP as it is written. How can I look a the result set after calling the SP? I want to look at the result set and do comparisons to ensure it returned what I was expecting. Something like this:
set @var1, @var = (CALL test('1', '2');)
if @var1 <> 1 then
select 'Error, @var1 should be 1';
I realize I would need to wrap that in a SP. I also realize that a SP can return multiple result sets and I need to get the first of the result sets and maybe assign that to a cursor. Is there a way to do this in MySQL? Otherwise, I need to do this in a different language (i.e. Python, PHP, etc), but, that adds another layer for what should be a unit test for the SP itself.