Solved

in an Oracle table I need to determine if a number is an even number or odd number

Posted on 2011-03-02
2
403 Views
Last Modified: 2012-05-11
How do I write a sql query which determines if a street number is an even number or an odd number for an oracle table.  This is my query so far:

SELECT ADDRESS_LIBRARIES.SPL_ID,
ADDRESS_LIBRARIES.JS_CODE,
ADDRESS_LIBRARIES.RULE_TYPE,
RESIDENTIAL_ADDRESSES.HS_NUM,
RESIDENTIAL_ADDRESSES.ADDR_NON_STD,
RESIDENTIAL_ADDRESSES.STREET_NAME
FROM ADDRESS_LIBRARIES,
RESIDENTIAL_ADDRESSES
WHERE ADDRESS_LIBRARIES.ID = RESIDENTIAL_ADDRESSES.ADRLIB_ID
AND ADDRESS_LIBRARIES.JS_CODE = RESIDENTIAL_ADDRESSES.JS_CODE
AND ADDRESS_LIBRARIES.RULE_TYPE = 1

Thanks
0
Comment
Question by:restockett
2 Comments
 
LVL 4

Accepted Solution

by:
Alex Matzinger earned 250 total points
Comment Utility
You can use the mod function.  If you wanted all the even numbers add this to your where clause

AND mod(RESIDENTIAL_ADDRESSES.HS_NUM, 2 ) = 0

if you wanted odd

AND mod(RESIDENTIAL_ADDRESSES.HS_NUM, 2 )  != 0
0
 

Author Closing Comment

by:restockett
Comment Utility
Thanks.  That worked.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now