I can run this command on Oracle 10.2 without problem:
SQL> select instr(unistr('foo'), chr(4050596145)) as hazit from dual;
HAZIT
----------
0
So I tried to encapsulate it into a function:
CREATE OR REPLACE FUNCTION hazit(string IN VARCHAR2) RETURN INTEGER
AS
BEGIN
RETURN instr(unistr(string), chr(4050596145));
END;
/
Function created.
But I get a numeric overflow error when I try to use it:
SQL> 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
What gives?
I don’t have an explanation but this seems to work:
Here is a fiddle