How can I call a MySQL procedure in where clause?
In the example demo
is a table name get_name()
is a function and 1
is a paramete
You should use a function instead of a procedure. A procedure returns a (one or multiple) result sets (tables), whereas a function returns a single value.
You should think twice before using functions in where-clause, if they contain select clauses from the database, as it may lead into situation where the query optimizer unable to optimize the query path resulting serialized queries and poor performance. If the data amount is small or you are ok with the possible performance hit, this would work.