Oracle: eval function

The function takes some expression as the argument and executes it, returning output in the varchar string


create or replace function eval (expr varchar2) return varchar2
as
ret varchar2(4000);
begin
execute immediate 'begin :result := ' || expr || '; end;' using out ret;
return ret;
end;
/

The discussion and examples could be found there

[amazon-product]1590599683[/amazon-product]