Tuesday, June 17, 2014

ODI Lookup Leftouter join and SQL Expression?

ODI Lookup Types :
-------------------------
1) LookUp Left Outer Join
2) LookUp SQL Expression in Select Clause




 Lookup Type Left outer join will generate below query:
--------------------------------------------------------------------





select   
    EMPLOYEES.EMPLOYEE_ID       C1_EMPLOYEE_ID,
    EMPLOYEES.FIRST_NAME       C2_FIRST_NAME,
    EMPLOYEES.LAST_NAME       C3_LAST_NAME,
    EMPLOYEES.EMAIL       C4_EMAIL,
    EMPLOYEES.PHONE_NUMBER       C5_PHONE_NUMBER,
    EMPLOYEES.HIRE_DATE       C6_HIRE_DATE,
    EMPLOYEES.JOB_ID       C7_JOB_ID,
    EMPLOYEES.SALARY       C8_SALARY,
    EMPLOYEES.COMMISSION_PCT       C9_COMMISSION_PCT,
    DEPARTMENTS.MANAGER_ID       C10_MANAGER_ID,
    DEPARTMENTS.DEPARTMENT_ID       C11_DEPARTMENT_ID
from    HR.EMPLOYEES    EMPLOYEES LEFT OUTER JOIN HR.DEPARTMENTS    DEPARTMENTS ON EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID
where    (1=1)

 Lookup Type SQL expression in select clause will generate below query:
--------------------------------------------------------------------------------------------



select   
    EMPLOYEES.EMPLOYEE_ID       C1_EMPLOYEE_ID,
    EMPLOYEES.FIRST_NAME       C2_FIRST_NAME,
    EMPLOYEES.LAST_NAME       C3_LAST_NAME,
    EMPLOYEES.EMAIL       C4_EMAIL,
    EMPLOYEES.PHONE_NUMBER       C5_PHONE_NUMBER,
    EMPLOYEES.HIRE_DATE       C6_HIRE_DATE,
    EMPLOYEES.JOB_ID       C7_JOB_ID,
    EMPLOYEES.SALARY       C8_SALARY,
    EMPLOYEES.COMMISSION_PCT       C9_COMMISSION_PCT,
    (Select DEPARTMENTS.MANAGER_ID From HR.DEPARTMENTS  DEPARTMENTS where EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID)       C10_MANAGER_ID,
    (Select DEPARTMENTS.DEPARTMENT_ID From HR.DEPARTMENTS  DEPARTMENTS where EMPLOYEES.DEPARTMENT_ID=DEPARTMENTS.DEPARTMENT_ID)       C11_DEPARTMENT_ID
from    HR.EMPLOYEES   EMPLOYEES
where    (1=1)

No comments:

Post a Comment