title: how to write a batch file, which runs a PL/SQL block, to tell me many records are inserted/deleted/etc. in a log file?
body: <p>I have created two batch files to run two separate .sql file in Windows Task Scheduler. The batch file for both looks like this:</p>
  
  <pre><code>sqlplus userid/password@database @C:\XXX.sql&gt;&gt;C:\output.log
  echo commit; | userid/password@database
  </code></pre>
  
  <p>The first .sql file (SQL1) is a PL/SQL block like this:</p>
  
  <pre><code>SET SERVEROUT ON
  DECLARE
   ....
  BEGIN
  IF ...
   ....
  ELSE  
  @D:\DM_FIX.sql;
  END IF
  END
  </code></pre>
  
  <p>The DM_FIX.sql file is to insert a bunch of records into a table, and it starts with the INSERT command.</p>
  
  <p>The second.sql file is not a block file. It's doing a bunch of DDL/DML comand. the file looks like below:</p>
  
  <pre><code>Truncate Table YYY
  Reuse Storage;
  Commit;
  
  Insert into Table YYY
  Select ... from
  Commit;
  
  Delete from Table YYY
  where ...
  Commit;
  </code></pre>
  
  <p>When I run the second .sql file, I get an output that indicates "The table has been truncated; #### records are inserted; #### records are deleted..."</p>
  
  <p>But when I run the first, although the PL/SQL procedure is executed successfully, I don't get a line saying how many records are inserted, and I'm trying to figure out a way to do it.</p>
  
  <p>Does any one know what could be the trick?</p>
  
  <p>Thanks!</p>