lundi 5 octobre 2015

Loop Logics (FOR LOOP , WHILE LOOP , IF LOOP)

Here 1 provider has multiple address as below .

TABLE A:
FCHN_PROVIDER_ID     PRACTICE_ADDRESS_1             PRACTICE_ADDRESS_2         
----------------     ------------------             ------------------         
100023               10604 NE 38th Pl               Ste 132                    
100023               9623 32nd St SE                Bldg A                     
100023               1207 13th St                   Ste G                      
10003                801 W 5th Ave                  Ste 412                    
10003                801 W 5th Ave                  Stes 307  309  310         
10003                910 W 5th Ave                  Ste 800                    
100038               3240 14th Ave NW                                          
100038               9927 Mickelberry Rd NW         Ste 101                    
100038               10501 Creek St                 Ste 2                      
100038               10501 Creek St SE              Ste 2                      

In this case, we need to add additional column PRAD_TYPE with different table name as TABLE B:

For which the first address for each provider should be PRIM and the remaining has to in incremental values upto 10 as below . I tried using while loop but couldn't get through

PRAD_TYPE  FCHN_PROVIDER_ID     PRACTICE_ADDRESS_1             PRACTICE_ADDRESS_2         
---------  ----------------     ------------------             ------------------         
PRIM         100023               10604 NE 38th Pl               Ste 132                    
01           100023               9623 32nd St SE                Bldg A                     
02           100023               1207 13th St                   Ste G                      
PRIM         10003                801 W 5th Ave                  Ste 412                    
01           10003                801 W 5th Ave                  Stes 307  309  310         
02           10003                910 W 5th Ave                  Ste 800                    
PRIM         100038               3240 14th Ave NW                                          
01           100038               9927 Mickelberry Rd NW         Ste 101                    
02           100038               10501 Creek St                 Ste 2                      
03           100038               10501 Creek St SE              Ste 2    

Aucun commentaire:

Enregistrer un commentaire