create or replace function get_value(theid in number) return varchar2 is rtVal varchar2(4000):=null; tname varchar2(30):=null; begin select nexttablename into tname from a where id=theid;
execute immediate 'select info from ' || tname || ' where id=' || theid into rtVal;
return rtVal; exception when others then return null; end; /
is
rtVal varchar2(4000):=null;
tname varchar2(30):=null;
begin
select nexttablename into tname from a where id=theid;
execute immediate 'select info from ' || tname || ' where id=' || theid into rtVal;
return rtVal;
exception
when others then return null;
end;
/