Temptable, extents and indexes

Jens

New Member
Hi,

I have a problem with a temp-table that (simplified) looks like this:

DEF TEMP-TABLE products
FIELD name AS CHAR
FIELD price AS INT EXTENT 10 INITIAL 0
INDEX idxname name
INDEX idxprice price.

There's not always a price in all of the 10 extents, so it might sometimes be 0.

When I do "CREATE products." I get
** Array subscript 0 is out of range. (26)
If I take away the idxprice index everything works, I also tried INDEX idxprice price[1], but that doesn't compile.

Any hints anyone?
Using 8.2B on Solaris 2.5

Regards
Jens
 
Hi Jens,

The problem is that you are trying to index an array and only word-indexes can be created with array fields. The error message isn't really helpful, and I'm sure that this situation could have been picked up by the compiler. But it isn't - so you're getting a run-time error instead.
 

Cabral

New Member
Hi, Jens

You can´t create an INDEX with ARRAY FIELD.

If you need some help, send me a mail.

Kind Regards,
Cabral.
CSI - Consulting - Sao Paulo - SP - BRAZIL.
cabral_rodrigo@hotmail.com
 

Chris Kelleher

Administrator
Staff member
Actually I would probably go with 2 temp-tables in the situation, one for products, then another table for all possible prices of that product. This should make it easier to work with, and will allow for no, one, or many prices for each product.

-Chris
 
Top