Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: multi-valued field?
Kevin:
In short no. DB2 does not have multi-value or sub-multi-value record like PICK or Revelation. The correct way to do this is with a child table as chuck has shown. If you currently have data with multi-valued records that needs to be converted to a relational format and need assistance let me know, as I have converted a lot of Rev databases to SyBase and Oracle.
Regards,
kdonovan_at_edgewater.com
chuckh_at_dvol.com (Chuck Hamilton) wrote:
>>> Kevin Kane wrote:
>>> >
>>> > Hi. Is there such a thing in DB2 as a multi-valued field? By this I mean
>>> > that I have a column called, say, AUTOMOBILES. If a person has 2
>>> > cars, then I would like the AUTOMOBILES field of his record to contain
>>> > 2 entries, one for each car.
>>> >
>>> > So, can DB2 handle this, or am I just going to have to cat the
>>> > individual values together into a character string with some kind of
>>> > delimiter?
>You aren't coming from a PICK environment are you?
>It can be done in a SQL database. The way to do it is to create a 2nd
>table for AUTOMOBILES (and all associated fields). This is called
>normalziation. Whatever you're using as the primary key for the OWNER
>table becomes a foreign key in the AUTOMOBILE table.
>OWNER
>=======
>owner_no PK
>name
>address
>etc.
>AUTOMOBILES
>===========
>auto_no PK
>owner_no FK reference to OWNER
>description
>license_no
>etc.
>--
>Chuck Hamilton
>chuckh_at_dvol.com
>This message delivered by electronic sled dogs. WOOF!
Received on Thu Jan 09 1997 - 00:00:00 CST