Skip to Main Content

How to get the just the Source Table name alias in an LKM

User_R2GNDSep 9 2022

I've added a task to a copy of an IKM that will delete all of the rows in table A if they don't exist in table B. I can get the source table name using snpRef.getFrom(). This gives me the table name and its alias. Is there a way to get the alias name only so I can reference it in my WHERE clause.
Basically, in the snippet below I want to be able to replace SRC with the table alias. The way I'm doing it now, I had to go into each datastore that uses this and change the alias to "SRC". It works but there has to be a better way than making the alias all "SRC" in the datastore.

DELETE FROM <%=snpRef.getTable("L","TARG_NAME","A")%> TGT
FROM <%=odiRef.getFrom()%>
WHERE <%=odiRef.getColList("", "\tTGT.[COL_NAME]=SRC.[COL_NAME]", "\n\tand\t", "", "PK")%>)

Post Details