If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > ADVANCED? matrix and combinations ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-03, 07:54
Soal Soal is offline
Registered User
 
Join Date: Dec 2003
Posts: 1
ADVANCED? matrix and combinations ?

MatrixTbl
MatxId     NoComb &n bsp;NoRows NoColumns
-------    ------  ------ ---------
1        & nbsp; 4      &n bsp;6      4


RowTbl
RowId   MatxId  NoValues
-----   ------  --------
1       1        2
2       1        1
3       1        1
4       1        1
5       1        1
6       1        2


ValueTbl
RowId  Value
-----  -----
1       1
1       2
2       1
3       3
4       2
5       4
6       2
6       3


I have 3 tables, Matrix,  Row and Value.
Matrix contains an ID, number& nbsp;of combinations, rows and&nbsp ;columns.

If we pick the following  values into a boolean matrix&n bsp;we would get something lik e:

Matrix size: 6 x 4
( T true, F false&nbsp
RowTbl: Row 1 has two val ues.
ValueTbl: Row 1 has value&nbsp ;1 and 2 enabled... etc

matrix = { {T,T,F,F}, 
        &n bsp;  {T,F,F,F}, 
        &n bsp;  {F,F,T,F}, 
        &n bsp;  {F,T,F,F}, 
        &n bsp;  {F,F,F,T}, 
        &n bsp;  {F,T,T,F} 
        &n bsp; }

I ve 4 combinations and t hey are the TRUE rows:
1-1-3-2-4-2
1-1-3-2-4-3
2-1-3-2-4-2
2-1-3-2-4-3

Please how can I get this  combinations in sql? pl/sql? do I need to use&nbs p;recursion ?
Can someone please help me!!!!

My wish is each time a&nb sp;matrix is created some sql,  pl/sql,(?) will run that will&nbs p;insert the
combinations in a table as:

CombinationTbl
CombinationId MatxId Combination
------------- ------ -----------
1        & nbsp;    1   &n bsp;  1-1-3-2-4-2
2        & nbsp;    1   &n bsp;  1-1-3-2-4-3
3        & nbsp;    1   &n bsp;  2-1-3-2-4-2
4        & nbsp;    1   &n bsp;  2-1-3-2-4-3


PLEASE how can I solve it  ??? We use Oracle9i.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On