Hmmm,But how to use pl code to output sql,?You cannot use PL in MySQL query browser. PL, actually just parses thhe variables and creates the final SQL statement. You have to send this SQL to the MySQL enegine. What you can do is use PL to output the SQL and then copy-paste the SQL in the MySQL browser.