title: Mysql make a stored procedure from multiple stored procedures
body: <h1>MySQL- Question</h1>
  
  <p>I have three stored procedures which gives same result set for different conditions and joining different tables.</p>
  
  <p>ex</p>
  
  <pre><code>procedure_one(StartDate,EndDate);
  procedure_two(StartDate,EndDate);
  procedure_three(StartDate,EndDate);
  </code></pre>
  
  <p>I need an another stored procedure which will gives the result from above three stored procedures. simply union of above three stored procedures. I don't want the union of 3 queries instead i want union of 3 stored procedures. I googled but unable to find good solution.</p>
  
  <p>I have made few attempts as follows.</p>
  
  <p>first attempt</p>
  
  <pre><code>DELIMITER //
  CREATE PROCEDURE `MasterProcedure` (IN StartDate DATE,IN EndDate DATE)
      BEGIN
          SELECT @CALL procedure_one (StartDate,EndDate) UNION
          SELECT @CALL procedure_two (StartDate,EndDate) UNION
          SELECT @CALL procedure_three (StartDate,EndDate);
      END //
  DELIMITER ; 
  </code></pre>
  
  <p>second attempt</p>
  
  <pre><code>DELIMITER //
  DECLARE var_val1 TEXT;
  DECLARE var_val2 TEXT;
  DECLARE var_val3 TEXT;
  CREATE PROCEDURE `MasterProcedure` (IN StartDate DATE,IN EndDate DATE)
      BEGIN
          SELECT @CALL procedure_one (StartDate,EndDate) INTO @var_val1;
          SELECT @CALL procedure_two (StartDate,EndDate) INTO @var_val2;
          SELECT @CALL procedure_three (StartDate,EndDate) INTO @var_val3;
          SELECT @var_val1,@var_val2,@var_val3;
      END //
  DELIMITER ;       
  </code></pre>
  
  <p>Is there any workaround to achieve this. Thanks in advance.</p>