Kingo Mostafa
Kingo Mostafa

Reputation: 347

Order By in esql

I have an xml message like this

<Body>
   <test>
       <element>2</element>
       <element>6</element>
       <element>1</element>
   </test>
</Body>

and i want to select the element with the lowest number

something like this

SET data[] = SELECT e FROM Output.Body.test.element[] AS e ORDER BY e.element;

I would have done this if the "ORDER BY" is supported in esql select but it is not, So is there any other way to do something like this?

I know the sql statements can be supported if i used PASSTHRU statement which passes the statement to the DBMS directly, but i am not using DBMS here, i am selecting from xml message.

Upvotes: 1

Views: 4041

Answers (1)

VincentS
VincentS

Reputation: 592

With the following link you can write a Quick Sort procedure to order your list. Then, you just have take the first element of the list.

Source: http://www.mqseries.net/phpBB2/viewtopic.php?p=273722#27372

(I only posted a link because the procedure code is pretty huge and could be updated by his creator)

Upvotes: 1

Related Questions