I have formula table with some of the formula. Is it possible to write SQL stored procedure which could evaluate every formula and give the result ? Every formula is an expression which could have all different arithmetic operations. Every value used in formula is an id value referring to some other table
FormulaId | Formula
--------------+-------------
1 | `1 * 3`
2 | `(2 + 3) * (4 + 1)`
3 | `((2 + 3) * (4 + 1)) / 5`
4 | `(4 + 1) - (3 + 1) - (2 + 1)`
Id | Value
--------------+-------------
1 | 5
2 | 10
3 | 15
4 | 20
5 | 25
Result should be something like
FormulaId | EvaluatedValue
--------------+----------------
1 | 75
2 | 625
3 | 25
4 | -10