TimeStamp问题

时间:2015-01-21 14:58:55

标签: esb ibm-integration-bus extended-sql

我在使用此代码段时遇到了问题:

DECLARE FormattedTimeStamp TIMESTAMP;
DECLARE pattern CHARACTER 'yyyy-mm-ddTHH:mm:ss';
SET FormattedTimeStamp = CAST(EnvRef.ConsumerTrxnsInq.paymentList[i].TransactionDate as DATE FORMAT 'yyyy-MM-dd');
SET OutputRoot.XMLNSC.ns:ConsumerTrxnsInqRs.Body.ConsumerTransaction[i].Timestamp = CAST(REPLACE(SUBSTRING(CAST(FormattedTimeStamp AS CHAR) before '.'),' ','T') AS TIMESTAMP FORMAT pattern);

当我运行它时,会产生此错误:

Error while casting. subParse failed. TIMESTAMPT'2014-12-02T15:39:21. yyyy-mm-ddTHH:mm:ss. TIMESTAMPT'2014-12-02T15:39:21. yyyy.

任何帮助?

2 个答案:

答案 0 :(得分:2)

您定义的模式存在问题。请更正如下.. 它应该工作..

  DECLARE pattern CHARACTER 'yyyy-MM-dd''T''HH:mm:ss';

答案 1 :(得分:0)

如果您使用T-SQL,那么 首先替换

DECLARE FormattedTimeStamp TIMESTAMP

DECLARE @FormattedTimeStamp TIMESTAMP