Use a stored procedure parameter for unit parameter of DATE_SUB
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-04-08T17:56:42Z
Indexed on
2010/04/08
18:13 UTC
Read the original article
Hit count: 602
I would like to know if it's possible to pass a parameter to a mysql stored procedure and use this parameter as the unit parameter of the DATE_SUB function. It seems that the unit parameter is a reserved word so I don't know if there's a type for unit.
Exemple of what I'm trying to do :
DELIMITER $$
DROP PROCEDURE IF EXISTS `test` $$
CREATE DEFINER=`root`@`%` PROCEDURE `test`(param1 unit)
BEGIN
select DATE_SUB(now(), INTERVAL 1 param1);
END $$
DELIMITER ;
© Stack Overflow or respective owner