npglobal
asked on
Mysql Storing Output of stored procedure on to a Temporary Table
although Procedure do not return anything but are there any methods through which we can Store Output of stored procedure on to a Temporary Table. Following case applies to a sub procedure.
scenario We are calling this sub procedure in the main procedure and we want to store the output of the sub procedure into the temporary table.
Eg
proc ABC(
sub proc E
()
)
we want the output of subproc E to be stored in to a temporary table so that we can use the temp table in our main prcedure ABC.
scenario We are calling this sub procedure in the main procedure and we want to store the output of the sub procedure into the temporary table.
Eg
proc ABC(
sub proc E
()
)
we want the output of subproc E to be stored in to a temporary table so that we can use the temp table in our main prcedure ABC.
Yes you can do that - provided this happens in same session....
Here is the test case for the same..
DELIMITER $$
DROP PROCEDURE IF EXISTS `E`$$
CREATE PROCEDURE `E`()
BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS uTemp(id int not null, name varchar(10));
INSERT INTO uTemp VALUES(1,'ushastry');
END$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `ABC`$$
CREATE PROCEDURE `ABC`()
BEGIN
CALL `ushastry`.`E`;
SELECT * FROM uTemp;
END$$
DELIMITER ;
### Usage
call ABC;
id name
1 ushastry
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Mr Shastry,
Thanks for the prompt response.
We have tried your solution with sime success. Good news.
We shall work on it further to validate our thoughts and update you tommorow with some posotive result
Thanks for the prompt response.
We have tried your solution with sime success. Good news.
We shall work on it further to validate our thoughts and update you tommorow with some posotive result
That's great.. Let me know if you need any assistance regarding this.
Regards,
Umesh
Regards,
Umesh