Forum Stats

  • 3,872,491 Users
  • 2,266,433 Discussions
  • 7,911,224 Comments

Discussions

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

User_R2GND
User_R2GND Member Posts: 1 Green Ribbon

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

 WHERE NOT EXISTS (SELECT 'X' 

               FROM  <%=odiRef.getFrom()%> 

               WHERE <%=odiRef.getColList("", "\tTGT.[COL_NAME]=SRC.[COL_NAME]", "\n\tand\t", "", "PK")%>)

Tagged: