|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
ESQL - Deleting Element after having selected it |
« View previous topic :: View next topic » |
Author |
Message
|
naio |
Posted: Tue Dec 03, 2013 10:16 am Post subject: ESQL - Deleting Element after having selected it |
|
|
Voyager
Joined: 08 Nov 2012 Posts: 82
|
Hi to All,
I am facing the following issue.
I am performing a Select Statement inside a While loop, to retrieve a field from an Array in the environment.
After retrieving the value of that field and save it into a variable, I would like to delete that entry of the array, in order to avoid in the next iteration of the While loop to analice that option (search everytime in a smaller array).
Code: |
WHILE (Index<=Count) DO
SET AuxVar = THE (SELECT E.start FROM Environment.Evento[] AS E
WHERE CONTAINS(E.componentName, EventName));
TODO: DELETE THE POSITION IN THE ARRAY THAT THE SELECT FOUND.
-- DO MORE THING WITH AuxVar
SET Index = Index + 1;
END WHILE; |
I know that with some Whiles and loop statement I could solve this, but I am trying to conserve the SELECT Statement for performance issues, I would like to know if there is any easy way to delete the field that the SELECT statement is finding. I could´t find and easy way yet.
Any healp would be appreciated.
Thanks you in advance! _________________ "God is in his heaven all's right with the world" |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Dec 03, 2013 11:09 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Perhaps another select with a negative "Where NOT CONTAINS" (or something like that)?
I'm not an expert on ESQL Selects by any shape or form but that seems to me to be the way to look at it in the first place _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
naio |
Posted: Tue Dec 03, 2013 11:13 am Post subject: |
|
|
Voyager
Joined: 08 Nov 2012 Posts: 82
|
Dear smdavies99,
Firtst of all, thanks for your reply.
That array holds eventually a lot a elements, the NOT CONTAIN in the select, was considered by me in some cases, but the NOT CONTAIN eventually will hold a lot of elements and still search in the complete array.
I would like to decrease the size of the array every time an element is found, in order to increase the performance.
Thanks in advance. _________________ "God is in his heaven all's right with the world" |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Dec 03, 2013 11:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Have you considered using references instead. Attach and detach works quite fine too.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Tue Dec 03, 2013 12:48 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I don't think you need to tune your algorithm. I think you need a better algorithm, based on a better data structure. Presumably, the SELECT statement is required because you need to perform these lookups in a particular order. That suggests that you would be better off sorting the array into order first, and then using a standard WHILE or FOR loop with a reference to iterate over the sorted array.
I realise that this solution may be overkill - but you did say that you wanted high performance  _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|