Procedure to traverse the table based on fk constraints [message #630137] |
Sat, 20 December 2014 22:49 |
|
zenthil86
Messages: 9 Registered: December 2014 Location: fremont
|
Junior Member |
|
|
table containing the relationship and contraint details like below
relations_tbl
CHILD_TBL_NAME PARENT_TBL_NAME CHILD_COL_NAME PARENT_FK_COL_NM
A null
B A bid aid
C B cid bid
X Y xid yid
Y A yid yid
entity 1 entity2
A>B>C A>Y>X
requirement to dynamically generate select statement for each table in the CHILD_TBL_NAME column with proper joining conditions
like below
for table A
select * from A
for table B
select * from B , C where B.bid = A.aid
for table C
select * from C, B, A where C.cid=B.bid and B.bid = A.aid
for table X
select * from X, Y, A where X.xid=Y.yid and Y.yid=A.aid
for table Y
select * from Y, A where Y.yid = A.aid
can anyone help me to implement this logic
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|