db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: problem with cast (null as int)
Date Mon, 03 Aug 2009 13:29:46 GMT
Rick Hillegas wrote:
> Hi Eranda,
>
> I am unable to reproduce this problem using ij against the trunk. The 
> following script runs correctly for me:
>
> connect 'jdbc:derby:memory:temp;create=true';
>
> values ( cast ( 1.5 as int ) );
> values ( cast ( null as int ) );
>
> values ( 3, cast ( 1.5 as int ) );
> values ( 3, cast ( null as int ) );

Hi,

I tried this as well, and saw the same result.
However, when I run the attached repro, it fails. A quick look at the 
repro shows that the following code causes the error:

       for (int i = 1;
                i <= rsmd.getColumnCount(); i++) {
            pSt.setObject(i, rs.getObject(i));
        }

I guess investigating what happens in getObject could be a step further.
What is getObject trying to do?
Is it allowed according to the standard(s)?
Is this a bug, or simply a feature we haven't implemented (yet)?


Regards,
-- 
Kristian
>
> Regards,
> -Rick
>
> Eranda Sooriyabandara wrote:
>> Hi,
>>
>> There is a problem with rs = st.executeQuery(
>>             "values (3, cast (null as int))");
>> And it gave the error
>> Exception in thread "main" java.sql.SQLDataException: An attempt was 
>> made to get a data value of type 'INTEGER' from a data value of type 
>> 'null'.
>>
>> Are there any reasons for this error occurring?
>> Thanks
>> Eranda
>


Mime
View raw message