views:

27

answers:

1

I'll avoid any explanations and just get to the question. Is there a way to accept multiple data types for one parameter of a MySQL stored procedure?

I want to be able to accept both int and varchar-typed data for an IN parameter of the procedure. Is this possible?

I know this is not good practice (I'd never choose to do it myself) but some other developers are asking for me to support it for easy access.

Thanks, Braeden

+4  A: 

No.

The closest way to do this is to set the parameter data type to text/varchar/etc and using dynamic SQL, which means MySQL's Prepared Statement syntax.

PS: Your developers deserve "the stink-eye" for their request

OMG Ponies
I agree; I should show them what you think of it.And yeah, that's what I was thinking. I'll give it a whirl, but I'll most likely end up doing it the right way instead.Thanks!
BraedenP