title: ROWTYPE definition in pl/sql
body: <p>I have written a PL/SQL Procedure which compares data between two tables and print the difference if any, but the twist is the table names to the procedure is dynamic. Here is the procedure</p>
  
  <pre><code>create or replace PROCEDURE compareTables(
  tabA IN VARCHAR2, tabB IN VARCHAR2) AS
      cur_tab_name USER_TABLES%ROWTYPE;
      lv_sql varchar2(4000);
      lv_sql2 varchar2(4000);
  BEGIN
  --SELECT TABLE_NAME INTO cur_tab_name FROM USER_TABLES WHERE TABLE_NAME = tabA;
  lv_sql2 := 'SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME = :b_tabA';
  EXECUTE IMMEDIATE lv_sql2 INTO cur_tab_name USING tabA;
      &lt;&lt;child&gt;&gt;
       DECLARE
           TYPE cursor_ref IS REF CURSOR;
           cur_comp_result cursor_ref;
           rec_comp_result cur_tab_name.TABLE_NAME%rowtype;
       BEGIN
            lv_sql := 'SELECT * FROM '||tabA||' MINUS SELECT * FROM '||tabB;
            OPEN cur_comp_result FOR lv_sql;
          LOOP
              FETCH cur_comp_result INTO rec_comp_result;
              EXIT WHEN cur_comp_result%NOTFOUND;
              DBMS_OUTPUT.PUT_LINE(rec_comp_result.empid || '' || rec_comp_result.name);
          END LOOP;
            CLOSE cur_comp_result;
       Exception 
          When others then 
                  dbms_output.put_line('The Problem is '||sqlerrm); 
  
       END;
  END compareTables;
  </code></pre>
  
  <p>Now the problem is when I compile this procedure I am getting the following error</p>
  
  <pre><code>Error at line 14: PLS-00310: with %ROWTYPE attribute, 'CUR_TAB_NAME.TABLE_NAME' must   name a table, cursor or cursor-variable
  </code></pre>
  
  <p>line 14:rec_comp_result cur_tab_name.TABLE_NAME%rowtype;</p>
  
  <p>how will I solve it?</p>
  
  <p>*NB: I don't have oracle installed in my system. I am using <a href="http://apex.oracle.com/" rel="nofollow">Oracle Apex Online tool</a> which uses
   Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 and
   PL/SQL Release 11.2.0.3.0</p>