|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Multiple DB2 Table entries and SELECT statement |
« View previous topic :: View next topic » |
Author |
Message
|
neeha_kashyap120 |
Posted: Thu Mar 05, 2009 1:04 pm Post subject: Multiple DB2 Table entries and SELECT statement |
|
|
 Apprentice
Joined: 05 Mar 2009 Posts: 31
|
Hi All
I tried to lookup previous posts but couldnt find any related to me, also looked up HELP but wasnt able toget teh answer.
I am using SELECT function to access queue and qmgr name from the database table based on Application name and Message type.
I noticed that someone entered two rows in the table having same App name and Msgtyp but diff Q and Qmgr names. When i sent a message through the flow, it selected the Q and Qmgr that was 2nd in order. I am not sure how it knew which to pick.
The entries in table are
AppGrp Msgtyp Q1 QMGR1
AppGrp MsgTyp Q2 QMGR2
The message ended up in Q2 QMGR2, I am not using any other XREFKey, just picking the destination based on AppGrp and Msgtyp. I know THE with SELECT returns the first one in list but here the second entry was picked.
Please help
Neeha |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Mar 05, 2009 1:31 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
I think you should look at the SQL documentation for the Database you are using.
That and with the PASSTHRU statement will allow you to select:-
- The first
- The last
etc
etc
Don't for get to make the select read only as well just so you don't keep a lock on the data. _________________ 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 |
|
 |
MQEnthu |
Posted: Thu Mar 05, 2009 8:44 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
neeha_kashyap120 wrote: |
I noticed that someone entered two rows in the table having same App name and Msgtyp but diff Q and Qmgr names. When i sent a message through the flow, it selected the Q and Qmgr that was 2nd in order. I am not sure how it knew which to pick.
The entries in table are
AppGrp Msgtyp Q1 QMGR1
AppGrp MsgTyp Q2 QMGR2
The message ended up in Q2 QMGR2, I am not using any other XREFKey, just picking the destination based on AppGrp and Msgtyp. I know THE with SELECT returns the first one in list but here the second entry was picked. |
You can retrive all the matching rows from database using the PASSTHRU statenment...
Code: |
SET Environment.Variables.QmgrInfo[]= passthru(<your SQL select query> |
_________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
neeha_kashyap120 |
Posted: Fri Mar 06, 2009 5:16 am Post subject: |
|
|
 Apprentice
Joined: 05 Mar 2009 Posts: 31
|
Usually we wouldnot have duplicate entries like this for AppGrp and MsgTyp, but in case accidentally there is , I wanted to know which one would the SELECT choose. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Mar 06, 2009 5:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
neeha_kashyap120 wrote: |
Usually we wouldnot have duplicate entries like this for AppGrp and MsgTyp, but in case accidentally there is , I wanted to know which one would the SELECT choose. |
Unless you've taken specific action (THE or ITEM) it will return both as a result set. How your code reacts to that is a design decision.
Accidents like this can also be prevented by proper use of DB2 constraints. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
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
|
|
|
|