Skip navigation links

MySQL Forums :: Stored Procedures :: Pass date unit as parameter


Advanced Search

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

Options: ReplyQuote


Subject Views Written By Posted
Pass date unit as parameter 285 Stefan Maris 10/28/2009 07:21AM
Re: Pass date unit as parameter 216 Chad Bourque 10/28/2009 11:12AM


Sorry, only registered users may post in this forum.