Reputation: 43
I can't seem to figure this out and I've been at it for sometime now any help would be great thank you.
I have to prepare a simple procedure accepting one parameter, a date value, and using date addition functions in SQL (MySql if possible) return the parameter value minus 1 day
CREATE PROCEDURE get_date
IS
BEGIN
DATE_ADD(date,INTERVAL expr type)
END;
/
EXEC get_date
This was all I could come up with so far. Any help would be greatly appreciated.
That question is not just about select statement (ie, computing minus one day); I need help with a SQL procedure.
Upvotes: 0
Views: 38
Reputation: 48197
Maybe just create a function
CREATE FUNCTION simplefunction (s datetime)
RETURNS datetime DETERMINISTIC
RETURN DATE_SUB(s, INTERVAL 1 DAY);
SELECT simplefunction (anydate);
Upvotes: 1