title: Oracle Procedure error: numeric or value error: number precision too large?
body: <p>Here's the procedure:</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE GetBestSellingMovieByTimeId(timeId IN NUMBER) IS
    movieName Movie.Name%type;
    saleValue Sales.SaleValue%type;
  BEGIN
  SELECT * INTO movieName, salevalue FROM (
    SELECT m.Name, SUM(s.SaleValue) AS TotalSales 
      FROM Sales s 
      INNER JOIN Movie m ON s.MovieId = m.MovieId 
      WHERE s.TimeId = timeId 
      GROUP BY m.Name ORDER BY TotalSales DESC
    ) WHERE ROWNUM = 1;
    dbms_output.put_line(movieName ||', ' || saleValue);
  END;
  /
  exec GetBestSellingMovieByTimeId(2);
  </code></pre>
  
  <p>Here's the error:</p>
  
  <pre><code>Error starting at line 190 in command: exec GetBestSellingMovieByTimeId(2) 
  Error report: 
   ORA-06502: PL/SQL:numeric or value error: number precision too large
   ORA-06512: at "CM420B17.GETBESTSELLINGMOVIEBYTIMEID", line 5 
   ORA-06512: at line 1
  06502. 00000 -  "PL/SQL: numeric or value error%s"
   *Cause:    
   *Action:
  </code></pre>
  
  <p>TimeID is a NUMBER(2,0) FK on a Sales table. Passing the number 2 to the procedure shouldn't be out of range of the NUMBER(2,0) data type.</p>
  
  <p>Why does this procedure think the IN parameter is too large?</p>