0

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.

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137

1 Answers1

1

Maybe just create a function

CREATE FUNCTION simplefunction (s datetime)
   RETURNS datetime DETERMINISTIC
   RETURN DATE_SUB(s, INTERVAL 1 DAY);

SELECT simplefunction (anydate);
Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118