I am looking for the PL/SQL equivalent of the VBScript Exec and/or Eval
functions, i.e. I want to be able to dynamically create a statement, then
execute it in the current PL/SQL context, e.g.
declare
x integer := 5;
begin
ExecuteStatemen t('x := 10');
dbms_output.put _line(x); -- should put "10"
if EvaluateExpress ion('x*2 = 20') then
dbms_output.put _line('Yes');
else
dbms_output.put _line('No');
end if; -- should put 'Yes'
end;
EXECUTE IMMEDIATE doesn't seem to work, because it runs the statement in the
global context, not inside the context of the current function.
functions, i.e. I want to be able to dynamically create a statement, then
execute it in the current PL/SQL context, e.g.
declare
x integer := 5;
begin
ExecuteStatemen t('x := 10');
dbms_output.put _line(x); -- should put "10"
if EvaluateExpress ion('x*2 = 20') then
dbms_output.put _line('Yes');
else
dbms_output.put _line('No');
end if; -- should put 'Yes'
end;
EXECUTE IMMEDIATE doesn't seem to work, because it runs the statement in the
global context, not inside the context of the current function.
Comment