title: How to get number of rows affected by last several sql statement inside procedure in teradata?
body: <p>So let I have 3 merge statement inside the procedure:</p>
  
  <pre><code>CREATE PROCEDURE SP_Employee(OUT num_rows BIGINT)
  BEGIN
      MERGE INTO t1
           USING t2
      ...;
      MERGE INTO a1
           USING b2
      ...;
      MERGE INTO c1
           USING d2
      ...;
  END;
  </code></pre>
  
  <p>How can I get number of rows affected inside procedure? I know about <a href="http://www.info.teradata.com/HTMLPubs/DB_TTU_13_10/index.html#page/SQL_Reference/B035_1148_109A/ch04.06.21.html" rel="nofollow">ACTIVE_COUNT</a>, but can I use it? Is that <code>num_rows = ACTIVE_COUNT</code> will work, or need to add it to variable several times and initially set to 0?</p>