Re: Question Regarding Select Into

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 28 Dec 2005 07:52:34 -0500
Message-ID: <ypCdnVjhdq58Fi_eRVn-jg_at_comcast.com>


"kumar" <muthu.kumar_at_fmr.com> wrote in message news:1135761467.510505.58290_at_g47g2000cwa.googlegroups.com...
> Hi Mr. Frank
> Thanks for correcting me. That number was just an example as
> you rightly thought.
> As mentioned in the earlier mail, i had tried this as well.
>
> declare
> 2 a varchar2(30);
> 3 begin
> 4 select nvl(min(person_id),'asdf') into a from per_all_people_f
> where person_id = 110;
> 5* end;
>
> ERROR at line 1:
> ORA-01722: invalid number
> ORA-06512: at line 4
>
> It gives an invalid number error. Should min function be passed a
> number field or it can have any other datatype field as its argument?.
>

min can talk (nearly) any datatype (don't try longs or lobs)

nvl()'s parameters must be of the same datatype or oracle will do implicit conversion, and apparently chose to try to convert 'asdf' to a number

use cast or tochar on min() within the nvl()

++ mcs Received on Wed Dec 28 2005 - 13:52:34 CET

Original text of this message