title: How to get the number of rows in ROWTYPE variable
body: <p>I have two tables Table1 an dTable2 that have identical columns. I need to check if a particular id is in one of them and return the row of data from whichever table.
  I have the following PL/SQL code:</p>
  
  <pre><code>v_result Table1%ROWTYPE; 
  BEGIN
  
       SELECT a.*
       INTO   v_result
       FROM   Table1 a
       WHERE  a.id    = 123;
  
  
    EXCEPTION
  
       WHEN NO_DATA_FOUND THEN  -- when record not found
  
          SELECT b.*
          INTO   v_result
          FROM   Table2 b
          WHERE  b.id    = 123;
  
    END;
  </code></pre>
  
  <p>The issue is that the exception does not get thrown, so v_result returns no data. How can I check v_result for the number of rows?</p>
  
  <p>For cursor I can use ROWCOUNT but v_result is not a cursor. </p>
  
  <p>I also tried using count property but it errored out.</p>
  
  <p>I changed my code to:</p>
  
  <pre><code>v_result Table1%ROWTYPE; 
  BEGIN
  
       SELECT a.*
       INTO   v_result
       FROM   Table1 a
       WHERE  a.id    = 123;
  
       if v_result.count =0 then
          SELECT b.*
          INTO   v_result
          FROM   Table2 b
          WHERE  b.id    = 123;
       end if;
  
    EXCEPTION
  
       WHEN NO_DATA_FOUND THEN  -- when record not found
  
          SELECT b.*
          INTO   v_result
          FROM   Table2 b
          WHERE  b.id    = 123;
  
    END;
  </code></pre>
  
  <p>And got an error <code>component 'count' must be declared</code></p>
  
  <p>What am I doing wrong?</p>