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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pl/SQL Query 31 74
JDeveloper 12c for 32 bit 4 67
compre toata in where clue oracle 4 55
Oracle DATE Column Space 11 59
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

930 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

15 Experts available now in Live!

Get 1:1 Help Now