Refer to the below SQL. We need to save STD formula in table, but not able to evaluate this.
DROP TEMPORARY TABLE IF EXISTS _std ;
CREATE TEMPORARY TABLE _std(stdformula VARCHAR(4000), mu DECIMAL(18,9), newValue DECIMAL(18,9));
INSERT INTO _std VALUES('SQRT((POWER((5-mu), 2) + POWER((6-mu), 2) + POWER((7-mu), 2) + POWER((7-mu), 2) )/4)',5+6+7+7/4,7);
SET @temp=(SELECT REPLACE(stdformula,'mu',mu) FROM _std );
SELECT @temp;
-- @temp=> SQRT(( POWER((5-19.750000000), 2) + POWER((6-19.750000000), 2) + POWER((7-19.750000000), 2) + POWER((7-19.750000000), 2) )/2);
-- which is valid statement
SELECT SQRT(( POWER((5-19.750000000), 2) + POWER((6-19.750000000), 2) + POWER((7-19.750000000), 2) + POWER((7-19.750000000), 2) )/2);
-- How can we evaluate @temp using dynamic sql approach?? -- Below prepare is not working
PREPARE StmtStd FROM @temp;
EXECUTE StmtStd;
DEALLOCATE PREPARE Stmtstd;*