Re: greatest() a single-row function of sql
Date: Thu, 22 Feb 2001 18:49:23 +0800
Message-ID: <3a94f159.0_at_news.tm.net.my>
hi,
first of all using greatest u can compare only similar data types... in
oracle number conversion to character is implicit... hence when u give
select greatest ('X', 88) from dual;
oracle coverts 88 to char and then compares the 2 ascii values and returns X
(note: it will only convert to ascii only the first digit in the numeric
value... hence if u give something like greatest ('88', '100') answer
returned will be 88)
while in the other statement
select greatest (88, 'X') from dual;
u have give a numeric value first n hence oracle expects the second value to
be numeric too... hence the error.. notice that the * mark of the error is
on 'X'...
hope this helps...
regards,
"xgong" <xgong_at_mediaone.net> wrote in message
news:sC_k6.8487$CW1.6387485_at_typhoon.ne.mediaone.net...
> Hi,
> sorry about simple question,
>
> I am fine with following sql:
>
> SQL> select greatest ('X', 88) from dual
> 2 /
>
> G
> -
> X
>
> however, I have problem with following sql:
>
> SQL> select greatest(88, 'X') from dual
> 2 /
> select greatest(88, 'X') from dual
> *
> ERROR at line 1:
> ORA-01722: invalid number
>
> what is problem with 2nd one ?
>
> thank you in adavnce!
> xgong
>
>
Received on Thu Feb 22 2001 - 11:49:23 CET