XQuery - 函式 max



max函式用於獲取序列中出現的值最大的項。

語法

max($seq as item()*)

輸入引數

  • $seq − 提供的序列。一個序列可以包含 0 個或更多項。

示例

XQuery 表示式

let $items := (1,2,3,4,5,6)
let $max := max($items)
return
   <result>
      <max>{$max}</max>     
   </result>

輸出

<result>
   <max>6</max>  
</result>

驗證結果

為了測試上述功能,請替換books.xqy(在 環境設定 章節中提及)的內容為上述 XQuery 表示式,並執行 XQueryTester java 程式來驗證結果。

xquery_sequence_functions.htm
廣告
© . All rights reserved.