Hi Rob,
Sorry for the confusion. Lets get this all straight by this post.
(1)What I am trying to accomplish:
I like to get all the possible combinations of multiply records
(single column) into several records (multiply column) For example I
do have a table named teams in my database and if I do a select on it
I will get the following returned.
SQL> select * from teams;
ID
--
A
B
C
D
E
F
G
7 rows selected
Now I like to have all possible combinations of A,B,C,D,E,F,G. Meaning
the function / query / ?? should return something like this:
1 A B C D E F G
2 A B C D E G F
3 A B C D F E G
4 A B C D F G E
5 A B C D G E F
6 A B C D G F E
7 A B C E D F G
8 A B C E D G F
9 A B C E F D G
10 etc etc etc
The business reason for them to have this is that they would like to
know all possible combinations of a “team” of items and in which
sequence they can insert it into the final process. With the
possibility list planners are continuing in a following step. The
reason however is not that much of a issue I think,… we just need a
list of all possible combinations you can form in a way you can see
above here :-)
(2)Currently we have as a test a table with a single column which
contains the test data A,B,C, etc etc… when we have this part finished
we will replace the table with a view which will return a single
column with only the active options.
(3)The future data will be varchar2 data +/- 6 to 10 chars long.
(4)Do you have the ability to create functions (and types) in your
database (don't assume you do .. many DBAs lock this out)? Yes we
have, I have the ability to create functions, procedures, views,
tables.. all so no limitation on this side.. however we would like to
completely create by using SQL PL/SQL and not by invoking an other
language like for example java.
(5)Aha ;-) answer 4 :-)
Now as I already posted a example I will get back to that a little.
The example I posted is doing the trick a little.
This will return:
1 A B C
2 A C B
3 B A C
4 B C A
5 C A B
6 C B A
However this query will only work if I only have A,B,C in my table. It
should work and react as the input table is like:
SQL> select * from teams;
ID
--
A
B
C
D
E
F
G
7 rows selected
Then it should return automatically:
1 A B C D E F G
2 A B C D E G F
3 A B C D F E G
4 A B C D F G E
5 A B C D G E F
6 A B C D G F E
7 A B C E D F G
8 A B C E D G F
9 A B C E F D G
10 etc etc etc
Is this post making things a little more clear?
Regards,
Johan Louwers.