Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us