Tuesday, July 10, 2012

ODI Substitution methods Generating the Source Select Statement


Generating the Source Select Statement



LKMs and IKMs both manipulate a source result set. For the LKM, this 
result set represents the pre-transformed records according to the 
mappings, filters and joins that need to be executed on the source. For 
the IKM, however, the result set represents the transformed records 
matching the mappings, filters and joins executed on the staging area.


select <%=odiRef.getPop("DISTINCT_ROWS")%>
<%=odiRef.getColList("", "[EXPRESSION]\t[ALIAS_SEP] [CX_COL_NAME]", ",\n\t", "", "")%>
from <%=odiRef.getFrom()%>
where (1=1)
<%=odiRef.getFilter()%>
<%=odiRef.getJrnFilter()%>
<%=odiRef.getJoin()%>
<%=odiRef.getGrpBy()%>
<%=odiRef.getHaving()%>
To obtain the result set from any SQL RDBMS staging area server to build your final flow data, you would use the following SELECT statement in your IKM. Note that the getColList is filtered to retrieve only expressions that are not executed on the target and that are mapped to writable columns.
select <%=odiRef.getPop("DISTINCT_ROWS")%>
<%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "(not TRG) and REW")%>
from <%=odiRef.getFrom()%>
where (1=1)
<%=odiRef.getJoin()%>
<%=odiRef.getFilter()%>
<%=odiRef.getJrnFilter()%>
<%=odiRef.getGrpBy()%>
<%=odiRef.getHaving()%>
As all filters and joins start with an AND, the WHERE clause of the SELECT statement starts with a condition that is always true (1=1).

No comments:

Post a Comment