You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "Patrick Sp." <pa...@gmail.com> on 2007/09/27 16:23:10 UTC
Generic data types
Hello,
I am developing a java application that can store and retrieve data defined
by the following schema
CREATE TABLE Tag as (
TagGroup varchar(100),
TagValue varchar(64), //which data type???
);
However, in practice, the 'TagValue' may be of different data types (float,
varchar, int, etc). The right data type is known only at runtime.
My question is, how to declare 'TagValue' so it can be cast -in the java
application- to one of the data types supported by Derby? and then inserted
in the database in the right format?
Thanks for your answer.
--
по краям
--
View this message in context: http://www.nabble.com/Generic-data-types-tf4528719.html#a12922366
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Generic data types
Posted by "Patrick Sp." <pa...@gmail.com>.
Thaaaaaaaank you Bryan, it works :jumping:
P.
Bryan Pendleton wrote:
>
>> However, in practice, the 'TagValue' may be of different data types
>> (float,
>> varchar, int, etc). The right data type is known only at runtime.
>
> Here's a couple of ideas:
>
> - Declare the column as a string, and convert the various data types
> to and from string format when storing/retrieving them.
>
> - Declare multiple columns, each of the appropriate data type for its
> value, and use the right column for the right data type
>
> thanks,
>
> bryan
>
>
>
--
View this message in context: http://www.nabble.com/Generic-data-types-tf4528719.html#a12930282
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Generic data types
Posted by Bryan Pendleton <bp...@amberpoint.com>.
> However, in practice, the 'TagValue' may be of different data types (float,
> varchar, int, etc). The right data type is known only at runtime.
Here's a couple of ideas:
- Declare the column as a string, and convert the various data types
to and from string format when storing/retrieving them.
- Declare multiple columns, each of the appropriate data type for its
value, and use the right column for the right data type
thanks,
bryan