views:

1147

answers:

5

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.

+6  A: 

It's still not possible.

McWafflestix
+5  A: 

If you look into CREATE PROCEDURE Syntax for latest MySQL version you'll see that procedure parameter can only contain IN/OUT/INOUT specifier, parameter name and type.

So, default values are still unavailable in latest MySQL version.

Michael
+1  A: 

No, this is not supported in MySQL stored routine syntax.

Feel free to submit a feature request at bugs.mysql.com.

Bill Karwin
Posting this from the other question I asked:http://bugs.mysql.com/bug.php?id=15975
DJTripleThreat
A: 

That request is at least 4 years old now. And it seems to me already one day later it was accepted...

Maybe it is not yet implemented because it perhaps needs/leads to another non-ex feature in MySQL: Out of order (but named) parameters in the CALL.

[Excuse me for my reply comes pretty late, but I just start with MySQL after years of M$-SQL and was exactly today looking for information regarding this.]

JayBus