Pass date unit as parameter
Posted by:
Stefan Maris ()
Date: October 28, 2009 07:21AM
Hi,
does somebody know if and how you can pass a date-time unit to a stored procedure/function. I'm having a stored function which calculates recency of a date, and it returns a number:
- less then one 'week' = 1
- less then 2 'weeks' = 2
- less then 3 'weeks' = 3
- older = 4
I would like to generalize this function by passing the date unit 'DAY', 'WEEK', 'MONTH', 'QUARTER' or 'YEAR' as well. I would like to keep the function as performant as possible, since it will be quite often executed.
Regards
Stefan
Sorry, only registered users may post in this forum.
© 1995-2008 MySQL AB, 2008- Sun Microsystems, Inc.