I have a stored procedure in mysql.

There is a select query with dynamic input in where clause

How do I capture this dynamic select query into a variable ?