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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Import and exporting Oracle Data with encrypted columns 4 70
date show only hh:mm 2 50
PL/SQL: ORA-00979: not a GROUP BY expression 3 82
how to tune the query 17 85
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.  …
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 Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

734 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