Re: Array of Integer
Posted in 1993
->From: Apostolos Dedes <rmy!emory!widener!uunet!ge!dedes!dedes> ->Subject: Array of Integer ->To: rmy!informix-list ->Date: Wed, 3 Mar 93 11:57:01 EST ->Reply-To: rmy!emory!widener!uunet!ge!dedes!dedes ->Organization: GE Information Services ->Phone: (301)340-4959 -> ->Informix users: -> ->I need your help for the following problem : -> ->I want to create a table where a column is an array of SmallInt (like in C). -> ->Something like : -> ->create table Statistics( -> -> User_Number Char(4) not null, -> Stat SmallInt[255] ->); -> ->But I am unable to find any description (or way) to do this. -> ->One way (if an array is not allowed) is to define a char(4*255) field. So that ->field may be used as an Integer array in the C program. -> ->Your advices will be appreciated. -> ->Many thanks in advance, -> ->Apostolos Dedes. -> ->############################################################################# -># In-Real-Life : Apostolos Dedes | GEnie : APOSTOLOS # -># Zodiac-Sign : Leo | uunet : uunet!ge!dedes # -># Organization : GEIS | Work : (301)340-4959 # -># 401 N. Washington Str. | Home : (301)990-6572 # -># Rockville, MD 20850 | Fax : (301)340-5250 # ->############################################################################# -> Apostolos, Based on my limited understanding of normalization theory, having an array in a relational database violates "first normal form". In order to convert an existing data model to first normal form, repeating groups (Cobol terminology) and arrays (Fortran, Pascal, etc. terminology) are eliminated. Normalization then proceeds to other issues. Anyway, back to arrays: Because of the first normal form issue, many (most?) RDMBS's do not support arrays in the database. A few, such as Boeing Computer Service's RIM, which supports vectors and matrices, either choose to ignore this somewhat theoretical issue, or they say "an array is a single `thing', not a repeating group, and it's internal structure is not the business of the DBMS". The closest the Informix comes to "directly" supporting arrays is via blobs, which can have unspecified internal structure. Your approach to mask the integer array under a long CHAR data type seems to be the best work around that I see. Regards, Alan +------------------------------+---------------------------------------+ | R. Alan Popiel | Internet: alan@den.mmc.com | | Martin Marietta, LSC | ( Please note: My opinions do not ) | | P.O. Box 179, M/S 5422 | ( represent official Martin policy. ) | | Denver, Colorado 80201-0179 | Voice: 303-977-9998 | +------------------------------+---------------------------------------+