使用ESQL从Oracle获取数据时会自动修剪String,但在DB2中可以正常工作

时间:2014-09-25 12:57:21

标签: oracle11g extended-sql

我正在使用ESQL从Oracle获取数据并创建XML消息。 一切正常,但列名称FILENAME被自动修剪为20个字符。部分ESQL创建XML消息:

CREATE COMPUTE MODULE FileExpectedEvent
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
        DECLARE now CHARACTER;
        SET now = CAST(CURRENT_DATE AS CHARACTER FORMAT 'yyyy-MM-dd');

        CALL CopyMessageHeaders();      
        DECLARE DB_Schema NAME BAM_DB_Schema;
        SET Environment.Variables.ExpectedFiles.Rec[]
                = (SELECT TRIM(A.FILENAME) AS FILENAME, A.EXPECTED_DATE, A.EXPECTED_TIME, A.EXPECTED_ALERT_SENT, A.ARRIVED_DATE, A.ARRIVED_TIME
                   FROM Database.DB_Schema.BAM_EXPECTED_FILES AS A 
                   WHERE A.EXPECTED_DATE = now 
                   AND (A.EXPECTED_ALERT_SENT IS NULL OR A.EXPECTED_ALERT_SENT <> 'Y'));


        DECLARE  ResultRef REFERENCE TO Environment.Variables.ExpectedFiles.Rec[1];
        DECLARE expectedTimeStamp TIMESTAMP;


        DECLARE ns1 NAMESPACE 'http:///XYZ.xsd'; 

        WHILE LASTMOVE(ResultRef) = TRUE DO 
           SET OutputRoot.MQMD.Version = 2;
           SET OutputRoot.MQMD.Format = 'MQSTR   '; 
           SET OutputRoot.XMLNSC.ns1:ExpectedFile.(XML.NamespaceDecl)xmlns = 'http:///XYX.xsd';                                      
           SET OutputRoot.XMLNSC.ns1:ExpectedFile.ns1:FileName = ResultRef.FILENAME;

这是生成的XML示例

<NS1:ExpectedFile> 
 <NS1:FileName> OH_ODJFS_DAILY_83420</NS1:FileName> 
 <NS1:ExpectedDate> 2014-09-25</NS1:ExpectedDate> 
 <NS1:ExpectedTime> 07:00:00</NS1:ExpectedTime> 
 <NS1:ExpectedAlertTime> 2014-09-25T13:00:00-05:00</NS1:ExpectedAlertTime> 
 <NS1:ExpectedDateTimeStamp> 2014-09-25T12:00:00-05:00</NS1:ExpectedDateTimeStamp> 
 </NS1:ExpectedFile>

一切都如预期的那样好,但<NS1:FileName> OH_ODJFS_DAILY_83420</NS1:FileName>自动限制为长度20。修剪了20以上的文件名。[这适用于DB2]

需要帮助...提前感谢

0 个答案:

没有答案