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 » SELECT Function

Post new topic  Reply to topic
 SELECT Function « View previous topic :: View next topic » 
Author Message
arunkumar1989
PostPosted: Thu Dec 06, 2012 10:20 pm    Post subject: SELECT Function Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

Hi All,


I need to get lat five transaction of customer in bank db

Table Structures
--------------------


CUSTOMER
-------------

CUSTOMERID,CUSTOMERNAME,ACCOUNTNO........


TRANSACTION
-----------------

TRANSACTIONID,TRANSACTIONDATE,CUSTOMERID......................



this is my query
------------------

SELECT C.*,T.* FROM Database.CUSTOMER AS C,Database.TRANSACTION AS T WHERE C.CUSTOMERNAME=name and C.DOB=dob;


how can i get max recent five transactions from table,


please help me....!!!!!
Back to top
View user's profile Send private message Send e-mail
arunkumar1989
PostPosted: Thu Dec 06, 2012 11:51 pm    Post subject: Done Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

Hi all,


I have done this following code.

SET Recs.CustomerDetails[]=PASSTHRU('select * from customer as c,customertransaction as t where c.customerid=t.customerid and c.customername= ? and c.dob= ? order by transactiondate desc fetch first 5 rows only' TO Database.bank VALUES (name, dob));


I have one more doubts here...

if Result set returns zero rows mean .... how i can check this..
Back to top
View user's profile Send private message Send e-mail
mqsiuser
PostPosted: Fri Dec 07, 2012 1:49 am    Post subject: Re: Done Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

arunkumar1989 wrote:
if Result set returns zero rows mean .... how i can check this..


IF CARDINALITY(Recs.CustomerDetails[]) = 0 THEN ... (that is the naive way)

... or you just step into the FIRSTCHILD (with a reference) and then check "IF LASTMOVE" is TRUE

probably the best thing is that you use EXISTS
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
arunkumar1989
PostPosted: Fri Dec 07, 2012 2:04 am    Post subject: Sorry its throwing Error Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

this is my code :
==========

SET Rec.CustomerInfo=PASSTHRU('select * from customer as c where c.customername= ? and c.dob= ?' TO Database.bank VALUES (name, dob));

IF Rec.CustomerInfo <> 0 THEN

SET Recs.CustomerDetails[]=PASSTHRU('select * from customer as c,customertransaction as t where c.customerid=t.customerid and c.customername= ? and c.dob= ? order by transactiondate desc fetch first 5 rows only' TO Database.bank VALUES (name, dob));

IF Recs.CustomerDetails[] <> 0 THEN
........................................

Error :
--------

BIP2420E: (.InquiryServicesFlow_Compute.Main, 14.30) : Invalid or incompatible data types for '<>' operator.
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Fri Dec 07, 2012 3:13 am    Post subject: Re: Sorry its throwing Error Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

arunkumar1989 wrote:
IF Recs.CustomerDetails[] <> 0 THEN
Error :
--------

BIP2420E: (.InquiryServicesFlow_Compute.Main, 14.30) : Invalid or incompatible data types for '<>' operator.


You were given the code already by mqsiuser.

mqsiuser wrote:

IF CARDINALITY(Recs.CustomerDetails[]) = 0 THEN ... (that is the naive way)

... or you just step into the FIRSTCHILD (with a reference) and then check "IF LASTMOVE" is TRUE

probably the best thing is that you use EXISTS
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SELECT Function
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.