Data Warehousing Community Forum
October 24, 2019, 01:14:41 am

Pages: [1]   Go Down
  Print  
Author Topic: Some help needed  (Read 3342 times)
haria_kishore
DW Fresher
*

Reputation: +2/-1
Offline Offline

Posts: 2


View Profile
« on: May 06, 2009, 04:17:18 pm »

hi

I have 3 tables - table1,table2,table3

table1 has 3 columns named col1,col2 and col3 and has 1 dummy record with values 0,1,2 respectively. The other records are my master records

col1   col2   col3
0            1         2
A            B         C
AA         BB      C
D            E         F


table 2 has the mapping of the column as shown below

ColNo      Name    Descr      Conditon
0            ABC         BC      Yes
1            DEF         DE      No
2            GHI         GH      Yes


Now i have to populate values in table 3 from table 2 and table 1

The logic is as follows

Suppose first i read col1 from table1. I look and take the value 0 (dummy value) and i check the in table 2 if for 0 the condition is Yes or No. If its No I ignore the col1 and move to col2. If not i start populating values of col1 first and then move to next col2.

In the above table shown above, since condition for 0 is Yes i read values for col1 (which will be A,AA,D) and from table 2 i read value for 0 (ABC,BC) and populate it in table3. Once all data is populated for col1, i move to col2. Since col2 condition is No in Table2, i ignore col2 and then i finally read col3 (the condition is Yes for col3 in Table2) and my table3 should look as follows

ColNo   Typ   Name    Descr
0         A      ABC      BC
0         AA   ABC      BC
0         D      ABC      BC
2         C      GHI      GH
2         F      GHI      GH

This can be accomplished either using functions or PL/SQL procedure
Logged
advertisement
Sipra
Founder
*****

Reputation: +56/-0
Offline Offline

Posts: 354


Am the King...


View Profile WWW
« Reply #1 on: May 11, 2009, 04:21:16 pm »

@Kishore -

Don't do create duplicate posts.  Undecided
Cleaned it finally Huh and please do post the threads with proper subject.

And please go thru the Forum Rules in prior to posting.  Angry
« Last Edit: May 11, 2009, 04:27:15 pm by Sipra » Logged

Pages: [1]   Go Up
  Print  
Jump to: