【发布时间】:2019-01-28 01:48:17
【问题描述】:
在我的 xquery 中,我有条件检查数组中是否 (SP_TYPE_CD!="") 和 (max of the EndDate) 并返回满足此条件的 EndDate
请求:
`<CMS xmlns="*******************">
<CMSService>
<CMSDetails AccountID="123456" CR="1000">
<SA_INFO_LIST>
<SA_INFO_LISTRow SA_ID="3484598047" ServiceAgreementType="OOVRPAY" ServicePointType="" SP_TYPE_CD="" Status="60" StartDate="2018-09-27" EndDate="2018-09-27"/>
<SA_INFO_LISTRow SA_ID="3486640145" ServiceAgreementType="OOVRPAY" ServicePointType="" SP_TYPE_CD="" Status="60" StartDate="2018-04-26" EndDate="2018-04-26"/>
<SA_INFO_LISTRow SA_ID="3487463777" ServiceAgreementType="ERES" ServicePointType="3135182884" SP_TYPE_CD="RESE" Status="70" StartDate="2018-04-06" EndDate=""/>
<SA_INFO_LISTRow SA_ID="3482685560" ServiceAgreementType="OOVRPAY" ServicePointType="" SP_TYPE_CD="" Status="60"
</SA_INFO_LIST>
</CMSServiceDetails>
</CMSService>
</CMS>
我的 Xquery:
for $SA_INFO_LISTRow in $StartServiceAllowedResponse/ns2:CMSService/ns2:CMSServiceDetails/ns2:SA_INFO_LIST/ns2:SA_INFO_LISTRow
return
if (($SA_INFO_LISTRow/@SP_TYPE_CD)and fn:max($SA_INFO_LISTRow/@EndDate))
then <ns1:date>{(fn:data($SA_INFO_LISTRow/@EndDate)}</ns1:date>
else ()
我在 jdeveloper 中运行 xquery 时收到错误消息
FORG0001: "2018-09-27": invalid value for cast/constructor: {http://www.w3.org/2001/XMLSchema}double: error: double: Invalid double value: 2018-09-27
【问题讨论】: