SET @qry = 'SELECT product_cd, name, product_type_cd, date_offered, date_retired
FROM product
WHERE product_cd = ?';
PREPARE dynsql2 FROM @qry;
SET @prodcd = 'CHK';
EXECUTE dynsql2 USING @prodcd;
SET @prodcd = 'SAV';
EXECUTE dynsql2 USING @prodcd;
DEALLOCATE PREPARE dynsql2;

动态生成SQL执行语句-LMLPHP

04-25 04:21