Dynamic Data Loading from database or source

    Hi All,

    This script will help us to load the data dynamically from different tables by passing the parameters.

    Hope this will help you. Thank you.

     

    SET LOC1='US';

    SET LOC2='IN';

    SET LOC3='UK';

    SET LOC4='GM';

    SET LOC5='AU';

    SET SCHEMA1='USDB';

    SET SCHEMA2='INDB';

    SET SCHEMA3='UKDB';

    SET SCHEMA4='GMDB';

    SET SCHEMA5='AUDB';

     

    For i= 1 to 5

    Employee_Details:

    Load EMPNO ,

      '$(LOC$(i))'&EMPNO as Emp_Key,

      JOB ;

    SQL SELECT *

    FROM $(SCHEMA$(i)).EMP1;

    Location_Details:

    Load REGION,

      '$(LOC$(i))'&REGIONID as LOC_Key ;

    SQL SELECT *

    FROM $(SCHEMA$(i)).LOCATION;

    Dept_Details:

    Load DEPTNO,

      '$(LOC$(i))'&LOCID as DEPT_Key,

      DNAME;

    SQL SELECT *

    FROM $(SCHEMA$(i)).DEPT;

    next