PL/SQL VALUE_ERROR exception not raised where expected
<p>I am sure my question has a simple theoretical answer but I cannot find it.</p>

<p>I have a procedure which accepts as parameter a NUMBER. It also have the VALUE_ERROR and OTHERS exceptions:</p>

<pre><code>create or replace procedure test( p1 number) is
begin
    null;
exception
    when VALUE_ERROR then
        RAISE_APPLICATION_ERROR(-20001, 'value_error');
    when others then
        RAISE_APPLICATION_ERROR(-20000, 'others');
end;
</code></pre>

<p>I am executing the procedure with a VARCHAR2 paramter:</p>

<pre><code>execute test('a');
</code></pre>

<p>... an I expect that the error message displayed to be </p>

<blockquote>
  <p>ORA-20001 value_error</p>
</blockquote>

<p>but, unfortunately, I got:</p>

<blockquote>
  <p>Error report - ORA-06502: PL/SQL: numeric or value error: character to
  number conversion error ORA-06512: at line 1
  06502. 00000 -  "PL/SQL: numeric or value error%s"
  *Cause:    An arithmetic, numeric, string, conversion, or constraint error
             occurred. For example, this error occurs if an attempt is made to
             assign the value NULL to a variable declared NOT NULL, or if an
             attempt is made to assign an integer larger than 99 to a variable
             declared NUMBER(2).
  *Action:   Change the data, how it is manipulated, or how it is declared so
             that values do not violate constraints.</p>
</blockquote>

<p>Can anyone explain this, or share a link where it is explained why I do not receive expected error message?</p>

<p>Thank you very much,</p>