Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB Function - Interpreting ip addresses

Status
Not open for further replies.

pflakes

Technical User
Jan 27, 2004
31
US
Mysql has a built-in function - inet_aton - which can interpret ip addresses and convert them to a numeric value. Is there any equivalent in Oracle? Or does anyone have any suggetions?

Currently in our database we store each octet in a different column. I'd like to get away from this if possible but I've found nothing yet to help me out.

Thank you in advance!
 
can you give an example for what an ip address looks like as a numeric then we can possibly help

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
An example of an ip address is 192.168.100.1

For the project I'm working on, you need to understand ip addressing and subnet masks - I don't have just one issue I'm trying to tackle - which is why I'm trying to find either a built-in procedure or someone who's done work with addressing. At this point I'm looking for resources.
 
so what would inet_aton in MYSQL do to 192.168.100.1
- how would it look ?

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
inet_aton converts the ip address - stored as a varchar to an integer ---

192.168.100.1 would be converted to some integer. You could convert the subnet mask as well, do some 'network math'. Then use inet-ntoa and convert it back to string so the address is readable again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top