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
409 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
migration MS SQL database to Oracle 30 71
Email query results in HTML 6 38
oracle date format checking 7 33
why truncate is faster than delete in oracle ? 4 46
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that useā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

756 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