Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
deva

New User

Joined: 03 Nov 2005
Posts: 19

 Posted: Fri Nov 02, 2007 10:56 pm    Post subject: How to know which condition true and which false in WHEN Hi, I have different situation.. SELECT * FROM TABLE EMP WHERE A = '10' AND B = '20' AND C = '30' Table values for A,B,C are 10, 20, 40. So obviously my query will return '100', here I know that third condition fails because '30' not matching with table C value '40' and rest the two are TRUE. Is there any thing know about this from query it self, means in WHERE because of which condition we received '+100'. Deva..

Craq Giegerich

Senior Member

Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

Posted: Fri Nov 02, 2007 11:16 pm    Post subject: Re: How to know which condition true and which false in WHEN

 deva wrote: Hi, I have different situation.. SELECT * FROM TABLE EMP WHERE A = '10' AND B = '20' AND C = '30' Table values for A,B,C are 10, 20, 40. So obviously my query will return '100', here I know that third condition fails because '30' not matching with table C value '40' and rest the two are TRUE. Is there any thing know about this from query it self, means in WHERE because of which condition we received '+100'. Deva..

No there is nothing that will tell which condition caused the not found, it would be possible (maybe not in you case) for multiple conditions to cause a not found.
deva

New User

Joined: 03 Nov 2005
Posts: 19

 Posted: Fri Nov 02, 2007 11:41 pm    Post subject: Reply to: How to know which condition true and which false i Is it possible to get for at least one condition , means is because of A='10' or not, no need to know about other two conditions but those two should be in query.
CICS Guy

Senior Member

Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

 Posted: Fri Nov 02, 2007 11:53 pm    Post subject: Use OR instead of AND and you will know that at least one of the conditions is true....Then check for yourself to see if all are true and/or which are false.....
dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

 Posted: Sat Nov 03, 2007 12:17 am    Post subject: Hello, Keep in mind that if multiple rows might be returned to your program, you will want to use a cursor. If a simple select returns multiple rows to your program, you will get a -811 return code from db2.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us