Is it possible to declare cursor with table name as parameter and then loop through it?
I'm trying something like this:
create or replace procedure p_update_something as
v_tab varchar2(100) := my_table;
v_name varchar2(100) := my_name;
cursor c_global (l_tab in varchar2, l_name in varchar2) is
select * from l_tab -- [here points the error]
where substr(comp_id, 1,2) in (l_name);
begin
for r in c_global(v_tab, v_name) loop
[update statement]
end loop;
end p_update_something;
but while compiling I'm getting error:
ORA-00942: table or view does not exist
in cursor declaration (marked in code above as [here points the error]).
Anyone have idea what is wrong with it?