Re: about nvl2 function

From: S. Anthony Sequeira <nobody_at_127.0.0.1>
Date: Tue, 08 Jun 2010 15:52:34 +0100
Message-ID: <4c0e592e$0$12169$fa0fcedb_at_news.zen.co.uk>



On 08/06/10 15:45, riverdance wrote:
> HI,
>
> sorry , I'm new to oracle world..
>
>
> who could help explain following.. I expected following SQL would
> error out.. but I got following result.
>
> I don't understand, how date format string '1/1/2010' could convert
> to number .000497512, and how date format string 1-1-2010 could
> convert to number -2010?
>
>
>
> SQL> select nvl2(birth_dt,0,1/1/2010) from eshen.test;
>
> NVL2(BIRTH_DT,0,1/1/2010)
> -------------------------
> .000497512
> .000497512
>
> SQL> select nvl2(birth_dt,0,1-1-2010) from eshen.test;
>
> NVL2(BIRTH_DT,0,1-1-2010)
> -------------------------
> -2010
> -2010

Do the math, look at date formats in the SQL Language reference, also see the TO_DATE function.

1 / 1 / 2010 = .0004975124
1 - 1 - 2010 = -2010

-- 
S. Anthony Sequeira
++
i'm living so far beyond my income that we may almost be said to be
living apart.
		-- e. e. cummings
++
Received on Tue Jun 08 2010 - 09:52:34 CDT

Original text of this message