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
413 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
Alex Matzinger earned 250 total points
ID: 35022971
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
ID: 35027403
Thanks.  That worked.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

630 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