vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Mahesh S wrote: > I would like to have an attribute that would store an integer or float > range (say 6 to 10). Is it possible to have both the lower and upper > limit specified in a single field? Not sure what you mean. Attributes are elements of structured types. Are you talking about a structured type? CREATE TYPE address AS (no INTEGER, street VARCHAR(30)) and you you want to constrain the attribute? You can't do this as part of CREATE TYPE, but you can overload the "mutator" and "constructor" to constrain what can be set. Or are you talking about a column rather than attribute? CREATE TABLE T(c1 float check (c1 between 6 and 10)) Cheers Serge -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| Hi Serge Well, let me clarify my question. What I would like to have is a single field that stores a range value instead of a single number. For instance, normally, you would store in an int field, say value 5. What I want to do instead is store the value [6, 10] inside a field which represents a range rather than a single value. Is that making any sense? Are there any structured types available that would let me store a range instead of a single value. I hope you are familiar with this math notation [6,10] which implies all values between and including 6 and 10. Thanks Mahesh |
| |||
| Mahesh S wrote: > Hi Serge > > Well, let me clarify my question. What I would like to have is a > single field that stores a range value instead of a single number. For > instance, normally, you would store in an int field, say value 5. What > I want to do instead is store the value [6, 10] inside a field which > represents a range rather than a single value. Is that making any > sense? Are there any structured types available that would let me > store a range instead of a single value. I hope you are familiar with > this math notation [6,10] which implies all values between and > including 6 and 10. You could create your own structured type "range" with, say, 4 attributes: lower bound, upper bound, inclusive_low, inclusive_high. OO is pretty haavy stuff and therefore not exactly popular outside of academia. I'm wondering why you would go through these lengths instead of simply storing the base information in the table. Cheers Serge -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| Thread Tools | |
| Display Modes | |
|
|