Accept Multiple Data Types in Stored Procedure
I'll avoid any ex开发者_StackOverflow社区planations 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
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
精彩评论