DB2 Version 9.7 for Linux, UNIX, and Windows

remove function

The fn:remove function removes an item from a sequence.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-fn:remove(source-sequence,remove-position)------------------><

source-sequence
The sequence from which an item is to be removed.

source-sequence is a sequence of items of any data type, or is the empty sequence.

remove-position
The position in source-sequence of the item that is to be removed. remove-position has the xs:integer data type.

Returned value

If source-sequence is not the empty sequence:
  • If remove-position is less than one or greater than the length of source-sequence, the returned value is source-sequence.
  • If remove-position is greater than or equal to one and less than or equal to the length of source-sequence, the returned value is a sequence with the following items, in the following order:
    • The items in source-sequence before item remove-position
    • The items in source-sequence after item remove-position
  • If source-sequence is the empty sequence, the returned value is the empty sequence.

Example

The following function returns the sequence that results from removing the item at position three from the sequence (1,2,4,7):
fn:remove((1,2,4,7),3)

The returned value is (1,2,7).