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
 
Use of 0<>0 in DB2 Sql..

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

New User


Joined: 23 Nov 2006
Posts: 22
Location: India

PostPosted: Wed Apr 09, 2008 3:18 am    Post subject: Use of 0<>0 in DB2 Sql..
Reply with quote

Hi, I have a COBOL program using the below SQL ,
SELECT EMP_NAME,EMP_LOC
FROM COMP_DET
WHERE (EMP_ID = :T00-EMP-ID
OR 0<>0)

Can you please help me out what is the purpose of '0<>0' condition in the WHERE clause.
FYI: Data type for EMP_ID is Integer.

Thanks in Advance.
Back to top
View user's profile Send private message

yogalakshmi

New User


Joined: 20 Sep 2007
Posts: 17
Location: cheenai

PostPosted: Wed Apr 09, 2008 10:12 am    Post subject: Reply to: Use of 0<>0 in DB2 Sql..
Reply with quote

If there is any index (say A) on EMP_ID, providing constraints like 0<>0,0=1 will force the optimizer not to choose that index(A) for the indexed access. In this case, as there is only one predicate that too on EMP_ID providing 0<>0 would lead to table space scan even though the indexed access is possible (by A).
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Wed Apr 09, 2008 8:43 pm    Post subject:
Reply with quote

Hi Natinuk,

This might be a good piece of information for you:

http://www.ibmdatabasemag.com/story/showArticle.jhtml?articleID=12803232

Thanks,
Prajesh
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:


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