title: Open cursor for dynamic table name in PL/SQL procedure
body: <p>I want to create procedure, that will use cursor, which is the same for arbitrary tables. My current one looks like this:</p>
  
  <pre><code>create or replace
    PROCEDURE
      some_name(
        p_talbe_name IN VARCHAR2,
        p_chunk_size IN NUMBER,
        p_row_limit IN NUMBER
      ) AS
  
    CURSOR v_cur IS
       SELECT common_column,
         ora_hash(substr(common_column, 1, 15), p_chunk_size) as chunk_number
       -- Here it can find the table!
       FROM p_table_name;
  
    TYPE t_sample IS TALBE OF v_cur%rowtype;
    v_sample t_sample;
  BEGIN
    OPEN v_cur;
    LOOP FETCH v_cur BULK COLLECT INTO v_sample LIMIT p_row_limit;
      FORALL i IN v_sample.first .. v_sample.last
      INSERT INTO chunks VALUES v_sample(i);
      COMMIT;
      EXIT WHEN v_cur%notfound;
    END LOOP;
    CLOSE v_cur;
  END;
  </code></pre>
  
  <p>The problem is that it cannot find the table named <code>p_table_name</code> which I want to parametrize. The thing is that I need to create chunks based on hashes for <code>common_column</code> which exists in all intended tables. How to deal with that problem? Maybe there is the equivalent oracle code that will do the same thing? Then I need the same efficiency for the query. Thanks!</p>