|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Initializing array in ESQL |
« View previous topic :: View next topic » |
Author |
Message
|
ENVYMB |
Posted: Tue Nov 19, 2013 10:08 pm Post subject: Initializing array in ESQL |
|
|
Newbie
Joined: 19 Nov 2013 Posts: 7
|
Hi,
I want to use an array in my esql and populate it with some data, which will be accessed in the later code. I have tried the below option and able to succeed.
SET vCount =1;
DECLARE vm ROW;
SET vm.Name[1]= '13';
SET vm.Name[2] = '08';
SET vm.Name[3] = '25';
SET vm.Name[4] = '06';
DECLARE vLen INTEGER;
SET vLen = CARDINALITY(vm.Name[]);
WHILE vCount <= vLen DO
Access array
SET vCount = vCount + 1;
END WHILE;
I want to know is there any way to intialize the array elements in single stattement rather than using multiple SET ststements. Please reply if any thoughts.
Thanks. |
|
Back to top |
|
 |
Esa |
Posted: Tue Nov 19, 2013 10:34 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
You can do it by combining LIST and ROW constructors. |
|
Back to top |
|
 |
Simbu |
Posted: Wed Nov 20, 2013 2:00 am Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
Esa wrote: |
You can do it by combining LIST and ROW constructors. |
LIST is sufficient to achieve this.
Quote: |
DECLARE vm ROW;
SET vm.Name[] = LIST{13,08,25,06}; |
|
|
Back to top |
|
 |
ENVYMB |
Posted: Wed Nov 20, 2013 10:34 pm Post subject: |
|
|
Newbie
Joined: 19 Nov 2013 Posts: 7
|
Thanks Simbu. This approach worked out !
Thanks Esa for your reply.
ENVYMB |
|
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
|
|
|
|