Re: greatest() a single-row function of sql

From: xgong <xgong_at_mediaone.net>
Date: Sat, 24 Feb 2001 14:36:28 GMT
Message-ID: <MFPl6.9549$CW1.8042844_at_typhoon.ne.mediaone.net>


Many thanks for your help!

xgong
"Biss Is Ignorance" <bliss_is_ignorance_at_hotmail.com> wrote in message news: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 Sat Feb 24 2001 - 15:36:28 CET

Original text of this message