Execute a string Query in mysql,Is it possible to execute a string in MySQL?,How to execute String in mysql.

Execute a string Query in mysql.

Example Procedure.
CREATE PROCEDURE SpRetrive($Squery nvarchar(16000))
BEGIN
  SET @stmt_str = $Squery;
  PREPARE stmt FROM @stmt_str;
  EXECUTE stmt;
  DEALLOCATE PREPARE stmt;
END
Execute procedure.
CALL SpRetrive('select * from state')

Result:

Post a Comment

0 Comments