这有个实例:
mysql> PREPARE stmt FROM -> 'select count(*) -> from information_schema.schemata -> where schema_name = ? or schema_name = ?' ; Query OK, 0 rows affected (0.00 sec) Statement prepared mysql> EXECUTE stmt -> USING @schema1,@schema2 +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.00 sec)
http://stackoverflow.com/questions/190776/how-to-have-dynamic-sql-in-mysql-stored-procedure
我希望是过程或者函数,将该动态语句返回给out参数或者函数的话返回该动态语句的值。