Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
CASE statement in WHERE clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sri.mainframes

New User


Joined: 16 Feb 2006
Posts: 29
Location: MUMBAI

PostPosted: Fri Apr 07, 2006 7:27 pm    Post subject: CASE statement in WHERE clause
Reply with quote

hi ,

Can we code a CASE statement in a WHERE clause in a QUERY?
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Apr 07, 2006 8:06 pm    Post subject: Re: CASE statement in WHERE clause
Reply with quote

Quote:
Can we code a CASE statement in a WHERE clause in a QUERY?

Why not... check below query...It is taken from the manuals...
Quote:
| Example 2 (searched-when-clause): You can also use a CASE expression to
| avoid "division by zero" errors. From the EMPLOYEE table, find all
| employees who earn more than 25 percent of their income from commission,
| but who are not fully paid on commission:

| SELECT EMPNO, WORKDEPT, SALARY+COMM FROM EMPLOYEE
| WHERE (CASE WHEN SALARY=0 THEN 0
| ELSE COMM/(SALARY+COMM)
| END) > 0.25;


Regards,
Priyesh.
Back to top
View user's profile Send private message
sri.mainframes

New User


Joined: 16 Feb 2006
Posts: 29
Location: MUMBAI

PostPosted: Fri Apr 07, 2006 8:13 pm    Post subject:
Reply with quote

thanks priyush
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts RFE: DB2 support for mixed case names. Pedro DB2 0 Tue Jul 04, 2017 1:32 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us