PL/SQL expression evaluator
· โ 2 min read
The following is a pretty nice expression evaluator for Oracle’s PL/SQL language. You pass it a string containing an expression that would return a numeric value when evaluated and it will evaluate the entire expression and return the number.
The passed expression must be in valid Oracle syntax or you will get a NULL instead of a number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 CREATE FUNCTION expression (iExpression IN varchar2) RETURN number AS vResult number; BEGIN ----------------------------------------------------------- -- Expression evaluator for PL/SQL.