Is it possible to have a default parameter for a mysql stored procedure?

aarona picture aarona · Jun 11, 2009 · Viewed 100.8k times · Source

I have googled this and keep coming up with "No it is not possible" but these posts were dated 2005-2007 so I'm wondering if this has been changed. A code example:

CREATE PROCEDURE `blah`
(
  myDefaultParam int = 0 -- This breaks the code for some reason
)
BEGIN
  -- Do something here
END

One of the solutions has been to pass null and then check for null and set the variable. I don't want to do that and I shouldn't have to. If this is true then MySql devs need to wake up because there is so much more I could do with MSSQL.

Answer

Paul Sonier picture Paul Sonier · Jun 11, 2009

It's still not possible.