Hola,
bien como dice el titulo tengo un error y se debe unicamente a desconocimiento, he estado leyendo todo el dia para aprender a hacerlo y finalmente recurro a ustedes el cuento es el siguiente.
Necesito que este proc. almacenado me entrege una diferencia de tiempos (en un solo campo, un solo valor), la instruccion SELECT funciona correctamente si la ejecuto sola, tanto en consola como en QueryBrowser, pero necesito que este dentro de un procedimiento almacenado.
Cita: DELIMITER $$
DROP PROCEDURE IF EXISTS `sp_tpodisponible` $$
CREATE PROCEDURE `sp_tpodisponible`(IN fini DATE, IN fter DATE)
BEGIN
SELECT TIMEDIFF(
CONCAT(date_format(`tiempom`.`t`.`fecha_ter`,_utf8 '%Y-%m-%d'),
_utf8' ',
(SELECT MAX(`tiempom`.`tb_ing_producto`.`hora_ter`)
FROM `tiempom`.`tb_ing_producto`
WHERE (`tiempom`.`tb_ing_producto`.`fecha_ter` = fter)
)
),
CONCAT(date_format(`tiempom`.`t`.`fecha_ini`,_utf8 '%Y-%m-%d'),
_utf8' ',
(SELECT MIN(`tiempom`.`tb_ing_producto`.`hora_ini`)
FROM `tiempom`.`tb_ing_producto`
WHERE (`tiempom`.`tb_ing_producto`.`fecha_ini` = fini)
)
)
)
FROM `tiempom`.`tb_ing_producto` `t`
LIMIT 1$$
END $$
DELIMITER ;
Los campos usados son
fecha_ini, fecha_ter DATETIME de forma YYYY-mm-dd 00:00:00 (no tiene hora)
hora_ini, hora_ter TIME
Desde ya muchas gracias por los aportes.
Atte