Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Get all possible combinations of values in a column

Nic709Jun 1 2015 — edited Jun 1 2015

Hi I am new to oracle and I'm trying to figure out how to get all possible combination of values in a column.

I have a table called ADJUSTMENT that contains the following data:

adj_id   adjustment_name         applied_order

1           adjustment1                  100

2           adjustment2                  200

3           adjustment3                  300

I have another table called ADJUSTMENT_GROUP that needs to contain all possible values from ADJUSTMENT (ordered by applied_order in the column).  The only possible values would be, separated by a ~.

grp_id   group_name

1           adjustment1

2           adjustment2

3           adjustment3

4           adjustment1~adjustment2

5           adjustment1~adjustment2~adjustment3

6           adjustment1~adjustment3

7           adjustment2~adjustment3

I also have a bridge table BRIDGE_ADJUSTMENT which will contains the following values:

grp_id   adj_id

1           1

2           2

3           3

4           1

4           2

5           1

5           2

5           3

6           1

6           3

7           2

7           3

How would I populate ADJUSTMENT_GROUP and BRIDGE_ADJUSTMENT using a query?  I have the data for the ADJUSTMENT table.  It contain more than 3 records but I provided 3 just for simplicity.

Any help would be greatly appreciated.  Thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2015
Added on Jun 1 2015
2 comments
706 views