Re: SE has array datatype?
Posted in 1995
> Subject: SE has array datatype?
> Date: Wed, 4 Jan 1995 18:09:27 GMT
> Reply-To: hotch@netcom.com (Hotchkiss and Wiley)
> Organization: NETCOM On-line Communication Services (408 261-4700 guest)
>
> I've just started using Informix SE with ESQL/C. As a
> complete novice, I found the installation and setting
> up a small test database very easy and straightforward.
> I am very pleased with SE so far. However, I can't figure
> out from reading the documentation if I can specify a
> datatype as an array since I want to repeat a decimal
> datatype across 40 columns.
> Do I have to say:
> $create table coupons
> {
> coupon1 decimal(5,3),
> coupon2 decimal(5,3),
> ...
> coupon40 decimal(5,3)
> }
> or is there a way to declare ...{ coupons[40] decimal(5,3) }
> If there is an array type, is it ANSI compliant?
>
> Rich P.
> hotch@netcom.com
Arrays violate the intent of first normal form, i.e. removal of repeating
fields.
Informix engines and SQL do not support arrays, tho' 4GL and ESQL/C both do.
I would suggest a slightly different structure for your table:
create table coupons
( key {whatever} identifies "row"
, idx smallint identifies "column"
, coupon decimal(5,3)
)
Thus in your example you would have 40 database rows for each logical
row in your matrix.
Regards,
Alan
+---------------------------+-----------------------------------------------+
| R. Alan Popiel | Internet: alan@den.mmc.com |
| Martin Marietta, SLS | Voice: 303-977-9998 |
| P.O. Box 179, M/S 3810 | Standard disclaimers apply. Cutesy ones, too. |
| Denver, CO 80201-0179 USA | Your mileage may vary. Void where prohibited. |
+---------------------------+-----------------------------------------------+