Re: ORA 06502 error when using TO_DATE with nls parameter inside function - 9i
Date: Thu, 1 Oct 2009 18:24:59 -0700 (PDT)
On Oct 1, 2:48 pm, steven acer <dudest..._at_gmail.com> wrote:
> Oracle9i Enterprise Edition Release 220.127.116.11.0 - PL/SQL Release
> 18.104.22.168.0 .
> Hi, i wrote the following function in oracle 9i :
> create or replace function isDate(inputStr VARCHAR2) RETURN NUMBER
> date DATE;
> RETURN 1;
> END ISDATE;
> SQL>function created
> i removed the exception block to show the exception being thrown .when
> i try to run it i get
> SQL>SELECT ISDATE('2001/01/01') from dual;
> ERROR at line 1:
> ORA-06502: PL/SQL: numeric or value error
> ORA-06512: at "CODSYS.ISDATE", line 5
> eventhough the value passed to the function is a valid gregorian
> date,the call to TO_DATE inside the function seems to spit an error,
> however if i use TO_DATE directly on the SQL command line it executes
> SQL> SELECT TO_DATE('2001/01/01','YYYY/MM/
> DD','NLS_CALENDAR=GREGORIAN') from dual;
> and if i remove the nls parameter from the call,
> NLS_CALENDAR=GREGORIAN and set the session's NLS_CALENDAR to GREGORIAN
> the function works as well.
> also on 10gR2(10.2.0.1.0 ), the same function runs normally and
> returns the correct value.
> i have the same nls session parameters on 9i and on 10g so i don't
> know what could the problem be, is it a difference in the way 10g and
> 9i handle it.
It is hard to understand exactly what you are doing since the code you posted is not evidently the code you are actually testing with.
It sounds like both the releases you are using 10.2.0.1.0 and 22.214.171.124.0 are base releases ... not patched with available maintenance from oracle ( well available if you have a support contract ). Whenever you start testing strange things and getting strange errors on base releases you may run into bugs that get patched later.
That could explain that it might have been fixed by 10.2.0.1.0 but could have been a bug in 126.96.36.199.0 ... try patching to 188.8.131.52 and see if your "bug" goes away. Received on Thu Oct 01 2009 - 20:24:59 CDT