Inside my stored function I have :

formula := "(10+10 * 1000)/12";

(a simple math formula, with numbers only, dynamically created as a string)

How do I eval this, and return the result ?

I can't use EXECUTE (not possible inside a stored function) and if I make it a stored procedure and call it from a stored function, I get "Dynamic SQL is not allowed in stored function or trigger" -as if I would have the eval directly inside the function.

I need a stored function, and not a procedure, because I need to call it inside a SELECT statement.

解决方案

Apparently there is no solution to this.

I have applied a "paintfull" workaround in PHP, which I will not display here as it is not the subject of the question.

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐