ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Issue updating a collection of rows in a database table

Post new topic  Reply to topic
 Issue updating a collection of rows in a database table « View previous topic :: View next topic » 
Author Message
polydegmon
PostPosted: Tue Mar 12, 2013 9:27 am    Post subject: Issue updating a collection of rows in a database table Reply with quote

Novice

Joined: 07 Oct 2011
Posts: 11

I'm trying to update a collection of rows in a database table using the code below, however it's not working and causes the debugger to terminate once I hit this line.

Code:

UPDATE Database.SchemaName.TableName AS PAY
   SET MY_IND = 0,
      CS_LST_UPDT_DT = CURRENT_TIMESTAMP
   WHERE PAY.TRKG_ID IN (Environment.Variables.Banking.BankingToBeRemoved[])


The Environment.Variables.Banking.BankingToBeRemoved[] arrays setup is shown below

Code:

Environment.Variables.Banking.BankingToBeRemoved[1].ReferenceID = '1';
Environment.Variables.Banking.BankingToBeRemoved[2].ReferenceID = '2';
Environment.Variables.Banking.BankingToBeRemoved[3].ReferenceID = '3';
Environment.Variables.Banking.BankingToBeRemoved[4].ReferenceID = '4';


I've tested the use of the IN keyword with the code below and it is working
Code:

UPDATE Database.SchemaName.TableName AS PAY
   SET MY_IND = 0,
      CS_LST_UPDT_DT = CURRENT_TIMESTAMP
   WHERE PAY.TRKG_ID IN ('1', '2', '3', '4')


Has anyone any ideas on this, any help would be great, thanks.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Mar 12, 2013 10:32 am    Post subject: Re: Issue updating a collection of rows in a database table Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

polydegmon wrote:
I'm trying to update a collection of rows in a database table using the code below, however it's not working and causes the debugger to terminate once I hit this line.


What does the user trace say is happening? The trace will contain the abend details.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Mar 12, 2013 10:46 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Code:
('1', '2', '3', '4')

is a list with 4 elements.
Code:
(Environment.Variables.Banking.BankingToBeRemoved[])
is a list with one element that happens to be an array with 4 children.
Back to top
View user's profile Send private message
polydegmon
PostPosted: Wed Mar 13, 2013 5:44 am    Post subject: Reply with quote

Novice

Joined: 07 Oct 2011
Posts: 11

Hi mqjeff, I've also tried the following format, however it is still causing the debugger to terminate.

Code:

SET Environment.Variables.Banking.BankingToBeRemoved.ReferenceID[1] = '1';
SET Environment.Variables.Banking.BankingToBeRemoved.ReferenceID[2] = '2';

UPDATE Database.SchemaName.TableName AS PAY
   SET MY_IND = 0,
      CS_LST_UPDT_DT = CURRENT_TIMESTAMP
   WHERE PAY.TRKG_ID IN (Environment.Variables.Banking.BankingToBeRemoved.ReferenceID[])


Can you tell me how I can use the IN keyword with a list of environment values?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Mar 13, 2013 6:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You need to transform your array of child elements into a list of values.

If I were to do this without reviewing the documentation on ESQL list and array values, I'd use an ESQL select to do this.

I recommend you review the documentation on ESQL list and array values.
Back to top
View user's profile Send private message
polydegmon
PostPosted: Thu Mar 14, 2013 6:38 am    Post subject: Reply with quote

Novice

Joined: 07 Oct 2011
Posts: 11

Hi mqjeff, I've done some testing with the IN keyword and it seems to work with any type of list or environment reference, until you try to pass it over to a database.

Even creating the list of values in the form '1', '2' as a string, when it's passed to the database it doesn't work. It seems to pass what ever is after the IN keyword to the database without first evaluating it.....it seems to be passing the variable name rather than the contents of the variable.

Has anyone found a way around this issue?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Issue updating a collection of rows in a database table
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.