This query will show the interface mapping in the following order
PROJECT_NAME , FOLDER_NAME , INTERFACE_NAME , INTERFACE_TYPE , TARGET_SCHEMA , TARGET_TABLE , TARGET_COLUMN , TARGET_DATATYPE , SOURCE_SCHEMA , SOURCE_TABLE , SOURCE_COLUMN , SOURCE_DATATYPE , MAPPING filtered by Interface , Folder or Project Name. I have commented out other option of Interface & Folder..
SELECT DISTINCT SNP_PROJECT.PROJECT_NAME AS PROJECT_NAME, SNP_FOLDER.FOLDER_NAME AS FOLDER_NAME, SNP_POP.POP_NAME AS INTERFACE_NAME, CASE WHEN SNP_POP.WSTAGE='E' THEN 'TABLE_TO_TABLE_INF' ELSE 'TEMP_INTERFACE' END AS INTERFACE_TYPE, SNP_POP.LSCHEMA_NAME AS TARGET_SCHEMA, SNP_POP.TABLE_NAME AS TARGET_TABLE, SNP_POP_COL.COL_NAME AS TARGET_COLUMN, CASE WHEN SNP_POP.WSTAGE='E' THEN T_COL.SOURCE_DT||' ('||T_COL.LONGC||')' ELSE SNP_POP_COL.SOURCE_DT||' ('||SNP_POP_COL.LONGC||')' END AS TRG_DATATYPE, SNP_SOURCE_TAB.LSCHEMA_NAME AS SOURCE_SCHEMA, SNP_TABLE.TABLE_NAME AS SOURCE_TABLE, SNP_COL.COL_NAME AS SOURCE_COLUMN , SNP_COL.SOURCE_DT||' ('||SNP_COL.LONGC||')' AS SRC_DATATYPE, rowtocol('SELECT DISTINCT TXT FROM SNP_TXT WHERE I_TXT='||i_txt ) AS COLUMN_MAPPING -- to use without rowtocol use SNP_TXT.TXT AS COLUMN_MAPPING FROM SNP_PROJECT LEFT OUTER JOIN SNP_FOLDER ON SNP_FOLDER.I_PROJECT=SNP_PROJECT.I_PROJECT LEFT OUTER JOIN SNP_POP ON SNP_POP.I_FOLDER=SNP_FOLDER.I_FOLDER LEFT OUTER JOIN SNP_POP_COL ON SNP_POP_COL.I_POP=SNP_POP.I_POP LEFT OUTER JOIN SNP_POP_CLAUSE ON SNP_POP_CLAUSE.I_POP=SNP_POP.I_POP LEFT OUTER JOIN SNP_TXT S_TXT ON S_TXT.I_TXT=SNP_POP_CLAUSE.I_TXT_SQL LEFT OUTER JOIN SNP_TXT ON SNP_TXT.I_TXT= SNP_POP_COL.I_TXT_MAP LEFT OUTER JOIN SNP_SOURCE_TAB ON SNP_SOURCE_TAB.I_POP=SNP_POP.I_POP LEFT OUTER JOIN SNP_TXT_CROSSR ON SNP_TXT_CROSSR.I_TXT=SNP_TXT.I_TXT LEFT OUTER JOIN SNP_COL ON SNP_COL.I_COL=SNP_TXT_CROSSR.I_COL LEFT OUTER JOIN SNP_TABLE ON SNP_TABLE.I_TABLE= SNP_COL.I_TABLE LEFT OUTER JOIN SNP_COL T_COL ON T_COL.I_COL=SNP_POP_COL.I_COL WHERE -- SNP_POP.POP_NAME='&TAB' -- SNP_FOLDER.FOLDER_NAME ='&TAB' SNP_PROJECT.PROJECT_NAME='DEVELOPMENT' ORDER BY SNP_POP.POP_NAME
I have used the rowtocol function for SNP_TXT.TXT ,as when mapping length is more than 256 character ODI stores in separate line with different i_txt number causing mapping to come into two or multiple rows . In order to avoid such scenario and in order to get all the Mapping field information into a single column , i have used this function rowtocol.
Source code for rowtocol function is available here – > http://www.oracle.com/technology/oramag/code/tips2004/050304.html
16 Comments
Leave a reply →