title: Stored Procedure to comapre 2 fields and return mismactch in another table
body: <p>I am creating  stored procedure in Oracle SQL Developer. I am trying to compare two columns form 2 tables and if any table has more records , I need to collect them  and store it in ( another table) my  stored procedure  works fine if I have  only one recorded mismatch, anything over one record and it throws </p>
  
  <p>ORA-01422: exact fetch returns more than requested number of rows
  ORA-06512: at "TEST_VAL", line 73
  ORA-06512: at line 2</p>
  
  <p>here is the query that run just fine  if I run it as SQL query</p>
  
  <pre><code>SELECT h.STATEMENTNUMBER, h.STATEMENTTOTAL
  FROM statement_header h
  MINUS
  SELECT j.STATEMENTNUMBER, j.STATEMENTTOTAL
  FROM jwf_statement j;
  </code></pre>
  
  <p>and my stored procedure looks like this </p>
  
  <pre><code>create or replace PROCEDURE        TEST_VAL 
  IS
  l_num_recs        VARCHAR2 (20);
  BEGIN
  select STATEMENTNUMBER into  l_num_recs
  from
  (SELECT H.STATEMENTNUMBER, H.STATEMENTTOTAL
  FROM statement_header H
  MINUS
  SELECT J.STATEMENTNUMBER, J.STATEMENTTOTAL
  FROM jwf_statement J
  
  );
  insert into l_num_recs values(l_num_recs);
  Commit;
  End;
  </code></pre>
  
  <p>any help is appriciated</p>