db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: implicite datacasting
Date Thu, 05 Nov 2009 16:19:38 GMT
Hello,

This is a known issue with Derby, tracked by 
https://issues.apache.org/jira/browse/DERBY-3662

In addition to the workaround you mentioned, you can write your own 
casting function.  Your statement would look something like this:

   INSERT INTO table1 (id, name, code) VALUES (1, 'somebody', 
myCastingFunction( 03184) )

Hope this helps,
-Rick


Hardie82 wrote:
> Hi,
>
> I have a problem with an insert-statement. I have an application that used a
> hsqldb. Now I want to switch to derby but got the problem that derby didn't
> cast an integer to a char-column. I always get an exception by the following
> example:
>
> INSERT INTO table1 (id, name, code) VALUES (1, 'somebody', 03184)
>
> Column code is type varchar(20) and I read elcewhere that derby implicite
> could parse this to varchar. Is this correct or should I cast it manually
> like 
>
> INSERT INTO table1 (id, name, code) VALUES (1, 'somebody', '03184') ?
>
> By the way with hsqldb the error didn't occur.
>
> Greetings
>   


Mime
View raw message