ODI KM替换阶段代码提交后出错

时间:2019-04-18 06:31:03

标签: oracle-data-integrator

我正在ODI 12.2.1中编写KM。我遇到下一个问题:
在完成任务中的代码编写并按“确定”后,代码的某些行已更改(错误): 正确代码示例:

INSERT INTO TABLE <?=tempTblNmDt?>
SELECT
<%=odiRef.getAllTargetColList("", "cast([COL_NAME] as [DEST_CRE_DT]) as [COL_NAME]", ",\n\t", "","") %>
FROM
(
SELECT
<%=odiRef.getColList("", "<? if ( (\u0022[DEST_CRE_DT]\u0022==\u0022TIMESTAMP\u0022) && (\u0022[DATA_FORMAT]\u0022!=\u0022N/A\u0022) ) {?> from_unixtime(unix_timestamp( [EXPRESSION], 'yyyy-MM-dd HH:mm:ss')) AS [COL_NAME]  <? } else { ?> cast([EXPRESSION] as [DEST_CRE_DT]) as [COL_NAME] <? }?>", ",\n\t", "","(INS and UPD)") %>
--TECHNICAL COLUMNS
,<?=vT_DL_CTI?> as T_DL_CTI
,from_unixtime(unix_timestamp()) as T_DL_INS_DT
,'<?=partDate?>' T_DL_COB_DT
FROM <?=tempTblNmStr?> <$=tableAlias$>
) SUBSELECT

按“应用”后,确定:

INSERT INTO TABLE <?=tempTblNmDt?>
SELECT
<%=odiRef.getAllTargetColList("", "cast([COL_NAME] as [DEST_CRE_DT]) as [COL_NAME]", ",\n\t", "","") %>
FROM
(
SELECT
<%=odiRef.getColList("", "<? if ( (\u0022[DEST_CRE_DT]\u0022==\u0022TIMESTAMP\u0022) && (\u0022[DATA_FORMAT]\u0022!=\u0022N/A\u0022) ) {?> from_unixtime(unix_timestamp( [EXPRESSION], 'yyyy-MM-dd HH:mm:ss')) AS [COL_NAME]  <? } else { ?> cast([EXPRESSION] as [DEST_CRE_DT]) as [COL_NAME] <? }?>", ",\n\t", "","(INS and UPD)") %>
--TECHNICAL COLUMNS
,<?=vT_DL_CTI?> as T_DL_CTI
,from_unixtime(unix_timestamp()) as T_DL_INS_DT
,'<?=partDate?>' T_DL_COB_DT
FROM <?=tempTblNmStr?> <$=tableAlias$>T
) SUBSELECT

示例2: 之前:

<$ if (KM_ALL_DELIVERY_TYPE.equals("INTRA_DAY_DELTA")) 
{
$>
<@
  intraDayPartitionLocation = "#location";
@>
<$
}
$>

之后:

<$ if (KM_ALL_DELIVERY_TYPE.equals("INTRA_DAY_DELTA")) 
{
$>
<@
  intraDayPartitionLocation = "#location";
@>
<
}
$>

示例3 之前:

<$ if (KM_ALL_DELIVERY_TYPE.equals("INTRA_DAY_DELTA")) 
{
$>
    SELECT
      ifnull(substring(location,instr(location,'datalake')),'N/A') location
    FROM
      hive.DBS
    LEFT JOIN hive.TBLS
    ON
      (
        DBS.DB_ID       = TBLS.DB_ID
      AND upper(TBLS.tbl_name) = '<$=tableShortNm$>_RAW'
      )
    LEFT JOIN hive.PARTITIONS
    ON
      (
        TBLS.TBL_ID = PARTITIONS.TBL_ID
      AND PARTITIONS.PART_NAME LIKE '%<$=partDate$>%'
      )
    LEFT JOIN hive.SDS
    ON
      (
        PARTITIONS.SD_ID = SDS.SD_ID
      )
    WHERE
      upper(DBS.name)='<$=rawSchema$>'
<$
}
$>

之后:

<$ if (KM_ALL_DELIVERY_TYPE.equals("INTRA_DAY_DELTA")) 
{
$>
    SELECT
      ifnull(substring(location,instr(location,'datalake')),'N/A') location
    FROM
      hive.DBS
    LEFT JOIN hive.TBLS
    ON
      (
        DBS.DB_ID       = TBLS.DB_ID
      AND upper(TBLS.tbl_name) = '<$=tableShortNm$>_RAW'
      )
    LEFT JOIN hive.PARTITIONS
    ON
      (
        TBLS.TBL_ID = PARTITIONS.TBL_ID
      AND PARTITIONS.PART_NAME LIKE '%<$=partDate$>%'
      )
    LEFT JOIN hive.SDS
    ON
      (
        PARTITIONS.SD_ID = SDS.SD_ID
      )
    WHERE
      upper(DBS.name>='<$=rawSchema$>'
<$
}
$>

此“中断代码”并不总是相同的。有时替换变量被破坏。如果需要,我可以提供更多示例。

解决方法是在外部应用程序(如记事本)中编写代码,然后从属性任务(而不是直接在任务中)复制并粘贴到“命令”部分中的代码。

有人知道是什么原因造成的吗? 并非每项任务都会发生。

0 个答案:

没有答案