Re: multi-valued field?
Posted in 1997
Topics: General Discussion
Tony Vuong wrote: > > Record Multi-Values > 1 a, b, c, d > 2 a, b > 3 d, e > 4 b, c > > During runtime, I would like to achieve a way of "breaking-up", or > "component-erizing" the Multi-Values into a dynamically created components > table so that operations involving sets and subsets can be performed on this > components table. One such components table might be: > > Id Single-Value > 1 a > 1 b > 1 c > 1 d > 2 a > 2 b > 3 d > 3 e > 4 b > 4 c > > The question is whether I can do the break-up with only SQL statements (without > procedural SQL like PL/SQL)? If not, then can I do it with procedural-SQL? > At present, I am restricted to using only SQL, so I am very much interested in > the first approach. However, if it is impossible to do it with SQL, then I'd > also like to get help on how that can be done with procedural-SQL. > O.K. But let me warn you I believe that you are probably overconstraining the problem and probably will not like a VERY GENERAL solution! So, We'll need some more basic info: Why do you feel that the "," delimiters are needed? How many values can the "single-value" value assume? (e.g. a-m would be 13 distinct values.) At most how many of these values can this field accomodate? (the max in your example is the first row which takes on 4 values.) Can a value be repeated? (e.g. a,a,c,d) Are the values ORDERED? Fundamentally I am asking: What is there that is internal to the problem that would let the solution be simpler? Steve Behman <sbehman@ibm.net>