title: What Causes the Numeric Overflow in this PL/SQL Function?
body: <p>I can run this command on Oracle 10.2 without problem:</p>
  
  <pre><code>SQL&gt; select instr(unistr('foo'), chr(4050596145)) as hazit from dual;
  
       HAZIT
  ----------
       0
  </code></pre>
  
  <p>So I tried to encapsulate it into a function:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION hazit(string IN VARCHAR2) RETURN INTEGER
  AS
  BEGIN
      RETURN instr(unistr(string), chr(4050596145));
  END;
  /
  
  Function created.
  </code></pre>
  
  <p>But I get a numeric overflow error when I try to use it:</p>
  
  <pre><code>SQL&gt; select hazit('foo') FROM DUAL;
  select hazit('foo') FROM DUAL
         *
  ERROR at line 1:
  ORA-01426: numeric overflow
  ORA-06512: at "DWHEELER.HAZIT", line 4
  </code></pre>
  
  <p>What gives?</p>