I have 2 procedures and I wanted to call the procedure sp_is_temporada
in the procedure sp_calcula_curso
, and the value that the procedure sp_is_temporada
return will be used in procecure sp_calcula_curso
, and the arguments that were passed in procedure sp_calcula_curso
will be used in procedure sp_is_temporada
.
DROP PROCEDURE IF EXISTS SP_IS_TEMPORADA;
DELIMITER //
CREATE PROCEDURE SP_IS_TEMPORADA(IN SPA_CURSO_ID INT, IN SPA_DATA DATE, IN SPA_CURSO_NAVIGATION_ID INT, INOUT SPA_TEMPORADA INT)
BEGIN
SELECT '1' INTO SPA_TEMPORADA FROM curso_temporada WHERE curso_id = SPA_CURSO_ID and SPA_DATA BETWEEN dt_inicio and dt_fim and IFNULL(curso_navigation_id,1) = IFNULL(SPA_CURSO_NAVIGATION_ID,1);
END //
DELIMITER ;
DROP PROCEDURE IF EXISTS SP_CALCULA_VALOR_CURSO;
DELIMITER //
CREATE PROCEDURE SP_CALCULA_VALOR_CURSO (IN SPA_CURSO_ID INT, IN SPA_CURS0_MOEDA_ID INT, IN SPA_IDADE INT, IN SPA_DATA DATE, INOUT SPA_VALOR_CURSO DOUBLE(20,2))
BEGIN
SELECT 'valor' INTO SPA_VALOR_CURSO FROM curso_preco2 WHERE curso_id = SPA_CURSO_ID AND moeda_id = SPA_CURS0_MOEDA_ID AND SPA_IDADE BETWEEN idade_de AND idade_ate;
END//
DELIMITER ;